summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-10-02 11:19:55 +0200
committerGoffin Simon <sig@odoo.com>2018-10-02 11:19:55 +0200
commit73b4abfcbcfd9bc1fd70e474a57d1f6d236e9bf8 (patch)
treed052a16be32b8c5636fbce119007bddbde13dbc0
parent88fa3826649af65612b46890dcd9f2a2a4fe108a (diff)
[FIX] sale_mrp: Updating delivered qty
Steps to reproduce the bug: - Create three stockable products: Kit, C1 and C2 - Create a phantom BOM for Kit with C1 and C2 as components - Set the invoicing policy of the kit based on delivered qty - Create an SO for the kit and validate it - On the delivery order, just deliver C1 and create a backorder for C2 - Cancel the backorder and duplicate it - Deliver the duplicated backorder and validate it Bug: The delivered qty on the SO line has not been updated to 1. opw:1886315
-rw-r--r--addons/sale_mrp/sale_mrp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py
index 3ac4d375487..67374edb4e2 100644
--- a/addons/sale_mrp/sale_mrp.py
+++ b/addons/sale_mrp/sale_mrp.py
@@ -35,7 +35,8 @@ class SaleOrderLine(models.Model):
# have changed, we don't compute the quantities but verify the move state.
bom = self.env['mrp.bom']._bom_find(product=self.product_id)
if bom and bom.type == 'phantom':
- bom_delivered = all([move.state == 'done' for move in self.procurement_ids.mapped('move_ids')])
+ moves = self.procurement_ids.mapped('move_ids').filtered(lambda m: m.picking_id and m.picking_id.state != 'cancel')
+ bom_delivered = all([move.state == 'done' for move in moves])
if bom_delivered:
return self.product_uom_qty
else: