[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) <nle@odoo.com>
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user