diff options
| author | Francisco Fernández @PlanetaTIC <ffernandez@planetatic.com> | 2019-01-08 11:35:23 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-05-22 07:40:32 +0000 |
| commit | 48e93a10a1d1dbb0c6301eb33cf433db6d59f02b (patch) | |
| tree | 06ab50488143a393eeaad18b39e99b1536ee8a16 | |
| parent | c89da3a68304dc971a642dcfc7eb01663ab6ddf6 (diff) | |
[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) <mat@odoo.com>
| -rw-r--r-- | addons/stock/models/product.py | 4 |
1 files changed, 4 insertions, 0 deletions
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: |
