Handle IntegrityError when saving PartPricing object (#6070)

This commit is contained in:
Oliver 2023-12-11 15:58:27 +11:00 committed by GitHub
parent 9ecaea2c12
commit 5b547f777d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2432,7 +2432,11 @@ class PartPricing(common.models.MetaMixin):
# If something has happened to the Part model, might throw an error # If something has happened to the Part model, might throw an error
pass pass
try:
super().save(*args, **kwargs) 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): def update_bom_cost(self, save=True):
"""Recalculate BOM cost for the referenced Part instance. """Recalculate BOM cost for the referenced Part instance.