[FIX] sale_mrp: filter cancelled moves when computing dropship delivered qty

The current behaviour implies that the quantity delivered will never
be updated if there are related moves that have been cancelled.

After the fix, when computing the quantity delivered, it will only
consider the stock moves that are not cancelled.

closes odoo/odoo#73573

X-original-commit: 6f6366888415c5e020ffee893a78cc7a3f6925f5
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
JordiMForgeFlow
2021-07-12 12:29:57 +00:00
committed by William Henrotin
parent 80b27a672f
commit a961edeff5
+2 -1
View File
@@ -86,7 +86,8 @@ class SaleOrderLine(models.Model):
# the products for this PO will set the qty_delivered. We might need to check the
# state of all PO as well... but sale_mrp doesn't depend on purchase.
if dropship:
if order_line.move_ids and all(m.state == 'done' for m in order_line.move_ids):
moves = order_line.move_ids.filtered(lambda m: m.state != 'cancel')
if moves and all(m.state == 'done' for m in moves):
order_line.qty_delivered = order_line.product_uom_qty
else:
order_line.qty_delivered = 0.0