[FIX] purchase_mrp: filter cancelled moves when evaluating kit
The current behaviour does not filter the cancelled moves when evaluating if the product of the purchase order line is a kit. This causes that, in cases where you have a cancelled wrong receipt where the product was being received as a kit, if a new receipt is created without receiving as a kit Odoo will always expect it as a kit. After the fix, the cancelled moves will not be considered, as this is what should be expected from cancelled operations. closes odoo/odoo#107144 X-original-commit: 9659683d1f09c49a3ba3df8770eb7256660d0033 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
committed by
William Henrotin
parent
4ac78ff3e9
commit
07b1aa5376
@@ -49,7 +49,7 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
def _compute_qty_received(self):
|
||||
kit_lines = self.env['purchase.order.line']
|
||||
lines_stock = self.filtered(lambda l: l.qty_received_method == 'stock_moves' and l.move_ids)
|
||||
lines_stock = self.filtered(lambda l: l.qty_received_method == 'stock_moves' and l.move_ids and l.state != 'cancel')
|
||||
product_by_company = defaultdict(OrderedSet)
|
||||
for line in lines_stock:
|
||||
product_by_company[line.company_id].add(line.product_id.id)
|
||||
|
||||
Reference in New Issue
Block a user