From 180b37869b53aeb4262d2f7b8c7d72859fd8ce24 Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Tue, 19 Sep 2023 15:23:37 -0400 Subject: [PATCH] bemade_stock_quant_valuation: update to calculate 0 difference when no counted quantity is present on the quant. --- bemade_stock_quant_valuation/models/stock_quant.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bemade_stock_quant_valuation/models/stock_quant.py b/bemade_stock_quant_valuation/models/stock_quant.py index 17e0d7b..5e679d3 100644 --- a/bemade_stock_quant_valuation/models/stock_quant.py +++ b/bemade_stock_quant_valuation/models/stock_quant.py @@ -16,6 +16,5 @@ class StockQuant(models.Model): @api.depends('inventory_diff_quantity', 'value_unit') def _compute_difference_value(self): - for rec in self: - rec.value_difference = (rec.value_unit * rec.inventory_diff_quantity - if rec.inventory_diff_quantity is not None else None) + for rec in self.filtered(lambda r: r.inventory_quantity is not None): + rec.value_difference = rec.value_unit * rec.inventory_diff_quantity