diff options
| author | Navarro Presas Moisés Alejandro <moisalejandro@gmail.com> | 2019-04-03 14:49:41 +0000 |
|---|---|---|
| committer | Arnold Moyaux <arm@odoo.com> | 2019-05-28 15:58:33 +0000 |
| commit | f1d8691985fb106ae52650cab4b9e6ebe73f6bba (patch) | |
| tree | 07255f11d59f788e17d6d8413fdde9ac51ed092c | |
| parent | fa294d2059bac600402363d5791a48de64316c2e (diff) | |
[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`.
| -rw-r--r-- | addons/sale_mrp/models/sale_mrp.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sale_mrp/models/sale_mrp.py b/addons/sale_mrp/models/sale_mrp.py index a17ef14d11f..1a795feaf7f 100644 --- a/addons/sale_mrp/models/sale_mrp.py +++ b/addons/sale_mrp/models/sale_mrp.py @@ -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: |
