[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`.
This commit is contained in:
Navarro Presas Moisés Alejandro
2019-05-28 15:58:33 +00:00
committed by Arnold Moyaux
parent fa294d2059
commit f1d8691985
+1 -1
View File
@@ -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: