Comment 5 for bug 669901

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

The "export only changed categories" in the connector for version 5 was not fine, so I'm sorry because I did not test enough my patch the last time.

The buggy use case is :
 - Creation of a category A in OpenERP
 - Creation of a category B in OpenERP
 - Set the category A as child of category B
 - Export the catalog
 - The connector creates the category A and after it creates the B. Normally it must create the B first, then the A below the B.

After many tests and debug, I found the problem.
I have pushed the correction of the connector on a branch : http://bazaar.launchpad.net/~gbaconnier-c2c/magentoerpconnect/magentoerpconnect/revision/361

As you may see, it is a small modification. In the mapping script of the parent_id, when the parent category does not exist, it calls ext_export to create it. But the ext_export method in magentoerpconnect/product.py needs the context's element "shop_id" which was not passed. Then the parent category was not created on Magento. I'm not sure if we have to pass the entire context variable or only the shop_id value.
I wonder if you have the same issue on the version 6 because the shop_id is not passed either.

The 2 lines modified in product.py are just to maintain the sorting of the categories and is a backport from the connector version 6.

To maintain the sorting, we also have to backport that revision on extra-addons : http://bazaar.launchpad.net/~openerp-commiter/openobject-addons/trunk-extra-addons/revision/5092.1.36
to ensure the order of the categories is maintained.
I have attached a patch with the modifications to apply on extra-addons version 5.0.

I tested a lot this correction, with creations of all categories from empty / updates / adds and indeed no update of the categories and it works well.

Hoping that will be useful.

Thanks & Regards
Guewen