[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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user