From 36b64e4b85cc39ede1202616c141bde94d7f33e1 Mon Sep 17 00:00:00 2001 From: mreficent Date: Thu, 19 Oct 2017 11:07:46 +0200 Subject: [PATCH] [IMP] fast compute _product_available() method is computed only once by location --- stock_available_unreserved/models/product.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stock_available_unreserved/models/product.py b/stock_available_unreserved/models/product.py index d638215ad..ff22b2b80 100644 --- a/stock_available_unreserved/models/product.py +++ b/stock_available_unreserved/models/product.py @@ -33,10 +33,9 @@ class ProductTemplate(models.Model): text = res[tmpl.id]['qty_available_stock_text'] tmpl.qty_available_stock_text = text - @api.multi - def _product_available(self, name=None, arg=False): - prod_available = super(ProductTemplate, self)._product_available(name, - arg) + def _compute_quantities_dict(self): + prod_available = super(ProductTemplate, self).\ + _compute_quantities_dict() variants = self.mapped('product_variant_ids') variant_available = variants._product_available() @@ -107,11 +106,12 @@ class ProductProduct(models.Model): return False @api.multi - def _product_available(self, field_names=None, arg=False): - + def _compute_quantities_dict(self, lot_id, owner_id, package_id, + from_date=False, to_date=False): res = super(ProductProduct, self).\ - _product_available(field_names=field_names, - arg=arg) + _compute_quantities_dict( + lot_id=lot_id, owner_id=owner_id, package_id=package_id, + from_date=from_date, to_date=to_date) domain_quant = self._prepare_domain_available_not_res(self)