mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Prevent BOM price calculation from becoming too recursive
This commit is contained in:
parent
cb636e000d
commit
4979c690d9
@ -824,6 +824,11 @@ class Part(models.Model):
|
|||||||
max_price = None
|
max_price = None
|
||||||
|
|
||||||
for item in self.bom_items.all().select_related('sub_part'):
|
for item in self.bom_items.all().select_related('sub_part'):
|
||||||
|
|
||||||
|
if item.sub_part.pk == self.pk:
|
||||||
|
print("Warning: Item contains itself in BOM")
|
||||||
|
continue
|
||||||
|
|
||||||
prices = item.sub_part.get_price_range(quantity * item.quantity)
|
prices = item.sub_part.get_price_range(quantity * item.quantity)
|
||||||
|
|
||||||
if prices is None:
|
if prices is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user