[FIX] mrp: remove unnecessary transit line on MTO overview

When displaying the MO Overview of a MTO product, "In Transit" lines
would be displayed for MTO components until the component was consumed.
Now checks whether the component is ready to be consumed (i.e. its
reservation is the MO itself, not a picking before) to know if it should
display the transit line or not.

Part of task-3251506

Part-of: odoo/odoo#114536
This commit is contained in:
clesgow
2023-10-20 14:59:09 +00:00
parent ea6b120524
commit 2c756c3d6f
+7 -2
View File
@@ -426,8 +426,13 @@ class ReportMoOverview(models.AbstractModel):
return replenishments
def _add_transit_line(self, move_raw, forecast, production, level, current_index):
in_transit = next(filter(lambda line: line.get('in_transit') and line.get('document_out') and line['document_out'].get('id') == production.id, forecast), None)
if not in_transit:
def is_related_to_production(document, production):
if not document:
return False
return document.get('_name') == production._name and document.get('id') == production.id
in_transit = next(filter(lambda line: line.get('in_transit') and is_related_to_production(line.get('document_out'), production), forecast), None)
if not in_transit or is_related_to_production(in_transit.get('reservation'), production):
return None
product = move_raw.product_id