diff --git a/connector_prestashop/models/product_product/common.py b/connector_prestashop/models/product_product/common.py index e949e4608..8ac38798a 100644 --- a/connector_prestashop/models/product_product/common.py +++ b/connector_prestashop/models/product_product/common.py @@ -167,11 +167,12 @@ class PrestashopProductCombination(models.Model): @api.multi def recompute_prestashop_qty(self): # group products by backend - backends = defaultdict(self.browse) + backends = defaultdict(set) for product in self: - backends[product.backend_id] |= product + backends[product.backend_id].add(product.id) - for backend, products in backends.iteritems(): + for backend, product_ids in backends.iteritems(): + products = self.browse(product_ids) products._recompute_prestashop_qty_backend(backend) return True diff --git a/connector_prestashop/models/product_template/common.py b/connector_prestashop/models/product_template/common.py index e407996ab..c704f826c 100644 --- a/connector_prestashop/models/product_template/common.py +++ b/connector_prestashop/models/product_template/common.py @@ -116,11 +116,12 @@ class PrestashopProductTemplate(models.Model): @api.multi def recompute_prestashop_qty(self): # group products by backend - backends = defaultdict(self.browse) + backends = defaultdict(set) for product in self: - backends[product.backend_id] |= product + backends[product.backend_id].add(product.id) - for backend, products in backends.iteritems(): + for backend, product_ids in backends.iteritems(): + products = self.browse(product_ids) products._recompute_prestashop_qty_backend(backend) return True