From 9b822496cbc894ae3fa40ca549d2538fffd011ea Mon Sep 17 00:00:00 2001 From: clesgow Date: Fri, 28 Jul 2023 16:57:05 +0200 Subject: [PATCH] [FIX] mrp: set right availability when subcontracting Steps to reproduce: - Enable subcontracting & multi-step routes - Inventory -> Routes -> Unarchive MTO - Create a subcontracted bom for a product S by vendor V - Set V as supplier for product S and set route Buy & MTO - Create a MO that uses S as a component and confirm it - Go to the related RFQ and confirm it - Go back to the MO and open the Overview Issue: The component S has its receipt marked as "Available", even though the product isn't received yet. When checking the previous moves in the chain, the move from production -> subcontracting (end move of the subcontracted MO) will be read and check its `reserved_availability`, which isn't right. Task-3251506 Part-of: odoo/odoo#114536 --- addons/mrp/report/mrp_report_mo_overview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/report/mrp_report_mo_overview.py b/addons/mrp/report/mrp_report_mo_overview.py index 74cd28c5f0d..27343f4c6af 100644 --- a/addons/mrp/report/mrp_report_mo_overview.py +++ b/addons/mrp/report/mrp_report_mo_overview.py @@ -730,7 +730,7 @@ class ReportMoOverview(models.AbstractModel): if not replenish_data['qty_reserved'].get(move_raw): total_reserved = 0 wh_location_ids = self._get_warehouse_locations(warehouse, replenish_data) - linked_moves = self.env['stock.move'].browse(move_raw._rollup_move_origs()).filtered(lambda m: m.location_id.id in wh_location_ids or m.location_dest_id.id not in wh_location_ids) + linked_moves = self.env['stock.move'].browse(move_raw._rollup_move_origs()).filtered(lambda m: m.location_id.id in wh_location_ids) for move in linked_moves: if move.state not in ('partially_available', 'assigned'): continue