From cf8073f3f43698825a8d105b57d73db583c96fc9 Mon Sep 17 00:00:00 2001 From: yhu-odoo Date: Tue, 2 Mar 2021 12:19:30 +0000 Subject: [PATCH] [FIX] mrp_subcontracting: wrong subcontracted productions Previously, when we find out subcontracted productions of moves, we get all production_id from the origin moves of the moves. When user use multple steps manufacturing, moves may also have their move_orig_ids. In this case, we will consider its production_id as subcontracted production. To fix, we filered the moves, consider only move that is_subcontract is true. closes odoo/odoo#67101 X-original-commit: 60d799059d60befc976fd0fe5e2c0afec5d3f83b Signed-off-by: Arnold Moyaux Signed-off-by: Yuchen Huang --- addons/mrp_subcontracting/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_subcontracting/models/stock_picking.py b/addons/mrp_subcontracting/models/stock_picking.py index 23949e6cac9..4649a0ef673 100644 --- a/addons/mrp_subcontracting/models/stock_picking.py +++ b/addons/mrp_subcontracting/models/stock_picking.py @@ -105,7 +105,7 @@ class StockPicking(models.Model): return self.picking_type_id.code == 'incoming' and any(m.is_subcontract for m in self.move_lines) def _get_subcontracted_productions(self): - return self.move_lines.move_orig_ids.production_id + return self.move_lines.filtered(lambda move: move.is_subcontract).move_orig_ids.production_id def _get_warehouse(self, subcontract_move): return subcontract_move.warehouse_id or self.picking_type_id.warehouse_id