From 5b547f777dba277b77bd9e0de5ddc3da771d3fd3 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 11 Dec 2023 15:58:27 +1100 Subject: [PATCH] Handle IntegrityError when saving PartPricing object (#6070) --- InvenTree/part/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 9ff41673ce..b3b409b5b1 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -2432,7 +2432,11 @@ class PartPricing(common.models.MetaMixin): # 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.