Merge lp:~richard-willowit/e-commerce-addons/get-ids-and-update-fix into lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-stable

Proposed by Richard deMeester
Status: Merged
Merged at revision: 279
Proposed branch: lp:~richard-willowit/e-commerce-addons/get-ids-and-update-fix
Merge into: lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-stable
Diff against target: 31 lines (+4/-4)
1 file modified
base_sale_multichannels/product.py (+4/-4)
To merge this branch: bzr merge lp:~richard-willowit/e-commerce-addons/get-ids-and-update-fix
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+118446@code.launchpad.net

Description of the change

Fix to list of exportable products for a shop.

get_ids_and_update_date for product.product works through a list of "exportable_product_ids" for a shop calling _check_if_export for each id.

The resulting list is then passed to super get_ids_and_update_date.

If the list is empty when the super function is called, then the super function assumes all ids.

Secondary fix is to return ([], {}) from get_ids_and_update_date instead of (False, False) - this is in line with the super functions returned data structure, and outer code which fails due to "False" not having a defined len()

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Seems fine to me.

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'base_sale_multichannels/product.py'
--- base_sale_multichannels/product.py 2012-08-01 13:00:46 +0000
+++ base_sale_multichannels/product.py 2012-08-07 00:17:22 +0000
@@ -52,17 +52,17 @@
5252
53 @only_for_referential(ref_categ ='Multichannel Sale')53 @only_for_referential(ref_categ ='Multichannel Sale')
54 def get_ids_and_update_date(self, cr, uid, external_session, ids=None, last_exported_date=None, context=None):54 def get_ids_and_update_date(self, cr, uid, external_session, ids=None, last_exported_date=None, context=None):
55 res = (), {} # list of ids, dict of ids to date_changed
55 shop = external_session.sync_from_object56 shop = external_session.sync_from_object
56 if shop.exportable_product_ids:57 if shop.exportable_product_ids:
57 product_ids = [product.id for product in shop.exportable_product_ids if self._check_if_export(cr, uid, external_session, product, context=context)]58 product_ids = [product.id for product in shop.exportable_product_ids if self._check_if_export(cr, uid, external_session, product, context=context)]
58 if ids:59 if ids:
59 product_ids = set(ids).intersection(set(product_ids))60 product_ids = set(ids).intersection(set(product_ids))
60 res = super(product_product, self).get_ids_and_update_date(cr, uid, external_session,61 if product_ids:
62 res = super(product_product, self).get_ids_and_update_date(cr, uid, external_session,
61 ids=product_ids,63 ids=product_ids,
62 last_exported_date=last_exported_date,64 last_exported_date=last_exported_date,
63 context=context)65 context=context)
64 else:
65 res = (), {} # list of ids, dict of ids to date_changed
66 return res66 return res
6767
68class product_category(osv.osv):68class product_category(osv.osv):
@@ -106,6 +106,6 @@
106 last_exported_date=last_exported_date,106 last_exported_date=last_exported_date,
107 context=context)107 context=context)
108 else:108 else:
109 res= [False, False]109 res = (), {} # list of ids, dict of ids to date_changed
110 return res110 return res
111111

Subscribers

People subscribed via source and target branches