[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
This commit is contained in:
clesgow
2023-10-20 14:59:09 +00:00
parent 57e31b7c82
commit 9b822496cb
+1 -1
View File
@@ -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