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
1=== modified file 'base_sale_multichannels/product.py'
2--- base_sale_multichannels/product.py 2012-08-01 13:00:46 +0000
3+++ base_sale_multichannels/product.py 2012-08-07 00:17:22 +0000
4@@ -52,17 +52,17 @@
5
6 @only_for_referential(ref_categ ='Multichannel Sale')
7 def get_ids_and_update_date(self, cr, uid, external_session, ids=None, last_exported_date=None, context=None):
8+ res = (), {} # list of ids, dict of ids to date_changed
9 shop = external_session.sync_from_object
10 if shop.exportable_product_ids:
11 product_ids = [product.id for product in shop.exportable_product_ids if self._check_if_export(cr, uid, external_session, product, context=context)]
12 if ids:
13 product_ids = set(ids).intersection(set(product_ids))
14- res = super(product_product, self).get_ids_and_update_date(cr, uid, external_session,
15+ if product_ids:
16+ res = super(product_product, self).get_ids_and_update_date(cr, uid, external_session,
17 ids=product_ids,
18 last_exported_date=last_exported_date,
19 context=context)
20- else:
21- res = (), {} # list of ids, dict of ids to date_changed
22 return res
23
24 class product_category(osv.osv):
25@@ -106,6 +106,6 @@
26 last_exported_date=last_exported_date,
27 context=context)
28 else:
29- res= [False, False]
30+ res = (), {} # list of ids, dict of ids to date_changed
31 return res
32

Subscribers

People subscribed via source and target branches