Hi Vikas,
On Jul 15, 2009, at 12:35 PM, Vikas Mayur wrote:
Hi,
I have introduced a feature called Verify Pick in Facility component
few months back based on a requirement. I was reviewing the code
more closely and found some issues.
The pre-condition to run this process is that order is in approved
status.
Steps to do Verify Pick are:
1) Create a Sales Order without split shipment option. Order should
be in approved status.
2) Go to Facility and select the WebStoreWarehouse facility.
3) Lets first check whether the order is ready to pick or need stock
move. To do this go to Picking tab.
4) If the order is ready to pick then click on Verify Pick tab.
5) Enter the order Id and click Verify Order. This will show the
list of the items that need to be verified, by default all of the
items are selected.
6) Click on Verify Items.
7) This will display the summary in another list at the bottom. User
have the option to either cancel or complete the verify order process.
8) Click on Complete button to verify the order.
If step 8 is a success then it will create a shipment in Picked
status and as well as generate an invoice with In-Process status.
The existing code was working fine but not implemented correctly as
it end up creating just an Invoice and Invoice Items at max but
there are certain other processes (entities where data is stored as
well) when an invoice is created as implemented in
createInvoiceForOrder service in InvoiceService class.
There is also an eca on updateShipment service which look for
shipment in PACKED status and then create the invoice. The service
triggered on eca is createInvoicesFromShipment. This service then
finally call createInvoiceForOrder and which create Invoice with In-
Process status, Invoice Items as well few other things as well.
Depending on the ProductStore.autoApproveInvoice flag, the status of
invoice is changed to INVOICE_READY and finally payment is captured
by capturePaymentsByInvoice triggered on eca rule defined on
createInvoiceForOrder. Finally, the invoice goes to PAID status,
Payments are captured and applied.
Coming back to my question a little bit, in the Verify Order step 8,
I do not want to capture payment and which is logical because
Invoice status is In-Process status.
My question is why payment is captured when the invoice status is In-
Process? Shouldn't the system look for Invoice Ready status to
capture the payments.
A simple solution: we could add a flag in the product store like this:
ProductStore.autoCapturePayments (default is Y).
But then the problem is that we need an easy way to capture payments
at a later moment (and not risk to forget them); we could do this
based on the invoice status or on another shipment status or manually
(but providing a good report/screen); what is your use case? when do
you want to capture payments?
Jacopo
If what I said above is true, I could use the existing artifacts and
do some changes so that system validate against the invoice status
before doing a capture.
Any suggestions are most welcome and appreciated.
Thanks,
Vikas