Add a timestamp to know which SO are already imported

Registered by Joël Grand-Guillaume @ camptocamp

Trouble :

Importing SO in OpenERP is based on last SO N°, so if you you import 1,2,4 and have trouble with 3, you will never get it again. This is also problematic when modifying a Magento order.

Suggested solution:

Add a timestamp as a flag on the SO (both side) and baed the importation on it. This will allow us to handle much more easily the exceptions. We'll need to customize a bit Magento for that.

Blueprint information

Status:
Started
Approver:
None
Priority:
High
Drafter:
None
Direction:
Needs approval
Assignee:
Guewen Baconnier @ Camptocamp
Definition:
Approved
Series goal:
None
Implementation:
Beta Available
Milestone target:
None
Started by
Guewen Baconnier @ Camptocamp

Whiteboard

This will also let continue the import even if a sale order import fail (related to blueprint add-log-for-syncing-op).
Very important otherwise hundreds of orders can be blocked if a sale order import fail.

Available in trunk version.

Needs the new magento module which extends the Magento API to manage that.
At the moment, it is in the branch lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev but it will be soon merged in the main magento module.

Now, the sales order import does :
 - Get the list of all the not imported orders from magento
 - Import them one by one
 - If suddenly it appears that an order is already imported, but is in the list given by magento (the update of the flag failed on magento or right after the update of the module), it skips the import of the order, and update the flag on magento
 - at the end of each import of a sale order, we update the flag on magento

To migrate to this import method, you have to solutions :
 - update yourself the "imported" column on Magento (with sql in sales_flat_order) on each orders you have imported on OpenERP (easy if you have imported all your orders on OpenERP).
 - Just run the "Import Orders" on OpenERP, but it can take some time if you have a lot of orders

Second improvement:
With this new import based on a flag we can as well deal with edited orders (when we edit 100000017, we get a new order 100000017-1 and 100000017 is canceled, etc.).
So I just added a loop which try to cancel all the previous orders (if you import the 100000017-6, tries to cancel 100000017-5, 100000017-4, ...) etc. (based on the parent field given by Magento).
As some orders can not be canceled (confirmed,...) a request is created with the information about the error.
Thoughts?

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.