Order update to Magento is wrong
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Magento OpenERP Connector |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When I run the order updates from the connector, the status of orders that are "done" will generate the status "closed" in Magento and this is wrong.
In Magento the order only will get the status closed when there has been generated a Creditnote for an allready generated invoice within Magento.
Orders that are invoiced, paid and shipped get the status "completed"
I changed the script and changed the status 'done': 'closed' to 'done': 'complete'.
I don't know if its because of this change but when i run the updater which last update had the datetime 06-02-2010 12:19:36 it started to update order before this date starting from 5 jan 2010 10:47:59. But is keeps changing the status form the first order that is in OpenErp and everytime it sends an email to the customer ( can we switch email sending off?).
Also when there is NO invoice created in Magento the connector generates the creation of an invoice but the invoice status in Magento is not set to "paid" but "pending" even when the status in OpenErp is "paid"
i changed in sale.py the line #32 from:
ORDER_STATUS_ MAPPING = {'draft': 'processing', 'progress': 'processing', 'shipping_except': 'complete', 'invoice_except': 'complete', 'done': 'closed', 'cancel': 'canceled', 'waiting_date': 'holded'}
to:
ORDER_STATUS_ MAPPING = {'draft': 'processing', 'progress': 'processing', 'shipping_except': 'complete', 'invoice_except': 'complete', 'done': 'complete', 'cancel': 'canceled', 'waiting_date': 'holded'}
This seems to do the trick for the right status for orders that are complete but now it also changes orders that have a creditnote and should have status "closed"
So the connector should include an API call to check if a creditnote exists in Magento for this order and then give the status "closed"
Also when there is NO invoice in Magento the connector generates an invoice for Magento but forgets to capture the payment. invoice. capture where the status is set to STATE_PAID = 2
The connector should check the payment status in OpenErp and when the status is "paid" it should also capture the payment after the invoice is created with the API CALL sales_order_
Please note that the connector checks the invoice to see if can be captured before attempting to capture an invoice, otherwise the API call with generate an error.