Skip to content
Snippets Groups Projects
Commit f1d86919 authored by Navarro Presas Moisés Alejandro's avatar Navarro Presas Moisés Alejandro Committed by Arnold Moyaux
Browse files

[FIX] sale_order: Set qty_delivered to 0 if not moves.

In `_compute_qty_delivered` function
Python `all` function returns `True` if list is empty; thast why check
if `moves` is not empty to set `qty_delivered` to `product_uom_qty`.
parent fa294d20
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ class SaleOrderLine(models.Model):
bom = self.env['mrp.bom']._bom_find(product=line.product_id, company_id=line.company_id.id)
if bom and bom.type == 'phantom':
moves = line.move_ids.filtered(lambda m: m.picking_id and m.picking_id.state != 'cancel')
bom_delivered = all([move.state == 'done' for move in moves])
bom_delivered = moves and all([move.state == 'done' for move in moves])
if bom_delivered:
line.qty_delivered = line.product_uom_qty
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment