From 48e93a10a1d1dbb0c6301eb33cf433db6d59f02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20=40PlanetaTIC?= Date: Tue, 8 Jan 2019 11:35:23 +0000 Subject: [PATCH] [FIX] stock: add mising depends on computed field The field had no triggers on the compute method. As the field is not stored, it works fine in most cases where the value is computed in a different transaction that the modification but when it is the case (e.g. OCA/connector-prestashop#101), the values were incorrect Add the correct triggers to recompute the value when needed closes odoo/odoo#30024 Signed-off-by: Martin Trigaux (mat) --- addons/stock/models/product.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 2032550c472..1a6144a015e 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -444,6 +444,10 @@ class ProductTemplate(models.Model): relation="stock.location.route", string="Category Routes", related='categ_id.total_route_ids') + @api.depends( + 'product_variant_ids', + 'product_variant_ids.stock_quant_ids', + ) def _compute_quantities(self): res = self._compute_quantities_dict() for template in self: