Merge lp:~akretion-team/magentoerpconnect/update_type into lp:magentoerpconnect/oerp6.1-stable

Proposed by Benoit Guillot - http://www.akretion.com
Status: Merged
Merged at revision: 685
Proposed branch: lp:~akretion-team/magentoerpconnect/update_type
Merge into: lp:magentoerpconnect/oerp6.1-stable
Diff against target: 18 lines (+5/-0)
1 file modified
magentoerpconnect/product.py (+5/-0)
To merge this branch: bzr merge lp:~akretion-team/magentoerpconnect/update_type
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+144895@code.launchpad.net

Description of the change

Don't update the product type in magento.
The magento API accept to change the type from configurable to simple but not the opposite, so updating the type could be dangerous.

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/product.py'
2--- magentoerpconnect/product.py 2012-12-07 13:50:28 +0000
3+++ magentoerpconnect/product.py 2013-01-25 11:20:27 +0000
4@@ -1131,9 +1131,14 @@
5 #Move this part of code in a python lib
6 ext_id = resource[main_lang]['ext_id']
7 del resource[main_lang]['ext_id']
8+ #avoid intempestive reset of type_id in magento
9+ if resource[main_lang].get('type_id'):
10+ del resource[main_lang]['type_id']
11 external_session.connection.call('ol_catalog_product.update', [ext_id, resource[main_lang], False, 'id'])
12 for storeview, lang in storeview_to_lang.items():
13 del resource[lang]['ext_id']
14+ if resource[lang].get('type_id'):
15+ del resource[lang]['type_id']
16 external_session.connection.call('ol_catalog_product.update', [ext_id, resource[lang], storeview, 'id'])
17 ext_update_ids[resource_id] = ext_id
18 return ext_update_ids