Catch potential error when refreshing part pricing (#4154)

This commit is contained in:
Oliver 2023-01-06 11:14:25 +11:00 committed by GitHub
parent f070c64534
commit 34bb40d439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2374,7 +2374,10 @@ class PartPricing(models.Model):
"""Recalculate all cost data for the referenced Part instance"""
if self.pk is not None:
self.refresh_from_db()
try:
self.refresh_from_db()
except PartPricing.DoesNotExist:
pass
self.update_bom_cost(save=False)
self.update_purchase_cost(save=False)