Skip to content

Commit

Permalink
Handle IntegrityError when saving PartPricing object (#6070)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat authored Dec 11, 2023
1 parent 9ecaea2 commit 5b547f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion InvenTree/part/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,11 @@ def save(self, *args, **kwargs):
# If something has happened to the Part model, might throw an error
pass

super().save(*args, **kwargs)
try:
super().save(*args, **kwargs)
except IntegrityError:
# This error may be thrown if there is already duplicate pricing data
pass

def update_bom_cost(self, save=True):
"""Recalculate BOM cost for the referenced Part instance.
Expand Down

0 comments on commit 5b547f7

Please sign in to comment.