Check the new boms with the boms we have in the cost_plan to avoid recursion.

044671
This commit is contained in:
Juanjo Garcia 2021-05-31 09:46:48 +02:00
parent e4762447bc
commit 89ce80efd9
1 changed files with 5 additions and 0 deletions

View File

@ -163,11 +163,16 @@ class Plan(ModelSQL, ModelView):
return boms
products = set(self.find_boms())
new_boms = set()
for index, (product_id, _) in enumerate(products):
new_boms.add(product_id)
boms['add'].append((index, {
'product': product_id,
'bom': None,
}))
if {x.product.id for x in self.boms if x.product} == new_boms:
return {}
return boms
def get_products_tree(self, name):