mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-10 06:37:17 +00:00
(cherry picked from commit 8c1c16e59a)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
co-authored by
Oliver
parent
1c4cfd8a47
commit
4a795ccddc
@@ -1061,12 +1061,21 @@ def after_delete_supplier_part(sender, instance, **kwargs):
|
|||||||
Triggers a pricing update for the linked Part, so that removal of a
|
Triggers a pricing update for the linked Part, so that removal of a
|
||||||
supplier part is reflected in Part pricing and BOM cost rollups.
|
supplier part is reflected in Part pricing and BOM cost rollups.
|
||||||
"""
|
"""
|
||||||
|
from part.models import Part
|
||||||
|
|
||||||
if (
|
if (
|
||||||
InvenTree.ready.canAppAccessDatabase(allow_test=settings.TESTING_PRICING)
|
not InvenTree.ready.canAppAccessDatabase(allow_test=settings.TESTING_PRICING)
|
||||||
and not InvenTree.ready.isImportingData()
|
or InvenTree.ready.isImportingData()
|
||||||
and instance.part
|
or InvenTree.ready.isRunningMigrations()
|
||||||
):
|
):
|
||||||
instance.part.schedule_pricing_update(create=False)
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
if part := instance.part:
|
||||||
|
part.schedule_pricing_update(create=False)
|
||||||
|
except (Part.DoesNotExist, SupplierPart.DoesNotExist):
|
||||||
|
# The underlying SupplierPart instance has been deleted
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
@receiver(
|
@receiver(
|
||||||
|
|||||||
Reference in New Issue
Block a user