Merge lp:~camptocamp/openerp-connector-magento/7.0-import-product-translations-1330116 into lp:~openerp-connector-core-editors/openerp-connector-magento/7.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 1002
Proposed branch: lp:~camptocamp/openerp-connector-magento/7.0-import-product-translations-1330116
Merge into: lp:~openerp-connector-core-editors/openerp-connector-magento/7.0
Diff against target: 42 lines (+9/-3)
2 files modified
magentoerpconnect/product.py (+2/-1)
magentoerpconnect/unit/import_synchronizer.py (+7/-2)
To merge this branch: bzr merge lp:~camptocamp/openerp-connector-magento/7.0-import-product-translations-1330116
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza (community) code review and test Approve
OpenERP Connector Core Editors Pending
Review via email: mp+223160@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

It is working as expected.

review: Approve (code review and 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 2014-05-26 09:37:00 +0000
3+++ magentoerpconnect/product.py 2014-06-14 20:34:29 +0000
4@@ -397,7 +397,8 @@
5 """ Hook called at the end of the import """
6 translation_importer = self.get_connector_unit_for_model(
7 TranslationImporter, self.model._name)
8- translation_importer.run(self.magento_id, binding_id)
9+ translation_importer.run(self.magento_id, binding_id,
10+ mapper_class=ProductImportMapper)
11 image_importer = self.get_connector_unit_for_model(
12 CatalogImageImporter, self.model._name)
13 image_importer.run(self.magento_id, binding_id)
14
15=== modified file 'magentoerpconnect/unit/import_synchronizer.py'
16--- magentoerpconnect/unit/import_synchronizer.py 2014-05-26 09:37:00 +0000
17+++ magentoerpconnect/unit/import_synchronizer.py 2014-06-14 20:34:29 +0000
18@@ -299,7 +299,7 @@
19 """ Return the raw Magento data for ``self.magento_id`` """
20 return self.backend_adapter.read(self.magento_id, storeview_id)
21
22- def run(self, magento_id, binding_id):
23+ def run(self, magento_id, binding_id, mapper_class=None):
24 self.magento_id = magento_id
25 session = self.session
26 storeview_ids = session.search(
27@@ -318,9 +318,14 @@
28 translatable_fields = [field for field, attrs in fields.iteritems()
29 if attrs.get('translate')]
30
31+ if mapper_class is None:
32+ mapper = self.mapper
33+ else:
34+ mapper = self.get_connector_unit_for_model(mapper_class)
35+
36 for storeview in lang_storeviews:
37 lang_record = self._get_magento_data(storeview.magento_id)
38- map_record = self.mapper.map_record(lang_record)
39+ map_record = mapper.map_record(lang_record)
40 record = map_record.values()
41
42 data = dict((field, value) for field, value in record.iteritems()