Use MatchMixin to get product bom

This commit is contained in:
Cédric Krier
2024-09-07 11:20:52 +02:00
parent a4eb342cd7
commit 1fcd308aa6
5 changed files with 25 additions and 12 deletions
+4 -3
View File
@@ -36,9 +36,10 @@ class Production(metaclass=PoolMeta):
@classmethod
def compute_request(
cls, product, warehouse, quantity, date, company,
order_point=None):
order_point=None, bom_pattern=None):
production = super(Production, cls).compute_request(
product, warehouse, quantity, date, company,
order_point=order_point)
production.routing = product.boms[0].routing if product.boms else None
order_point=order_point, bom_pattern=bom_pattern)
if bom := product.get_bom(bom_pattern):
production.routing = bom.routing
return production