oldstable: records created on magento during an sub-export are not visible in the export
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Magento OpenERP Connector |
New
|
Undecided
|
Unassigned |
Bug Description
Steps to reproduce :
- Create a category and a product on OpenERP (both exportable to Magento).
- Export them with export catalog, they are created on Magento, ok
- Create a new category on OpenERP
- Assign it to the product, run the manual export wizard on this product
Expected result:
The category is created on Magento
The product is linked with the category on Magento
Actual result:
The category is created on Magento
The product is not linked with the category on Magento
Explanation:
When we export the categories and products from the "export catalog", they are exported sequentially.
When we export a product manually but its category is not yet exported in Magento, it export the category in the same time.
This export is defined in the mappings.
So when we call ext_export() on the the product, it will:
- Create a transaction A for the export of the product -> take an db snapshot
- Convert the product to the Magento format with the mappings, see that the category does not exist on Magento, so:
-> Create a transaction B for the export of the category
- Convert the category to the Magento format (it could also need to export a category btw, so we nest the exports)
- Export the category
- Write the Magento ID in ir_model_data (Transaction B)
- Commit & close the transaction B
- Here the product flow continues, it searches the Magento ID of the category exported, BUT as the transaction A has been opened before the transaction B and the snapshot isolation level used in OpenERP is repeatable read, the transaction A cannot read the writes of the transaction B until the first commit or rollback on transaction A.
-> We cannot read the Magento ID of the category, it export the product without assigning the category.
I had the issue on the categories, but it maybe occurs elsewhere.