From b2b395467fec9daa6b8f1e97cacd3a739e48defe Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 27 Mar 2019 11:31:19 +0000 Subject: [PATCH] [FIX] delivery: picking weight not updated sometime The delivery lines (move_lines) have two way to be displayed in a view: - with move_lines (all move line of a stock.picking) - with move_ids_without_package (same but removing packages) But so if we write directly on move_ids_without_package we would not trigger the stock.picking @api.depends('move_lines') _cal_weight method thus the picking weight was not updated in some instances. With this changeset, we adds the move_ids_without_package as depends so on move_ids_without_package onchange the total weight should be set to the correct weight or 0 (if move_lines is not in the view) and on write the correct weight should be computed. opw-1959523 closes #32157 Signed-off-by: Nicolas Lempereur (nle) --- addons/delivery/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index e8a1344cb08..583bdb16398 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -101,7 +101,7 @@ class StockPicking(models.Model): for picking in self: picking.weight_uom_id = weight_uom_id - @api.depends('move_lines') + @api.depends('move_lines', 'move_ids_without_package') def _cal_weight(self): for picking in self: picking.weight = sum(move.weight for move in picking.move_lines if move.state != 'cancel')