mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Auto-rebuild the reference field for the SalesOrder on save
This commit is contained in:
parent
068b54f666
commit
d3d1d2f577
@ -31,7 +31,6 @@ def build_refs(apps, schema_editor):
|
|||||||
order.save()
|
order.save()
|
||||||
|
|
||||||
print(f" - Updated {n} PurchaseOrder objects")
|
print(f" - Updated {n} PurchaseOrder objects")
|
||||||
|
|
||||||
print("\n - Rebuilding reference field for SalesOrder model...")
|
print("\n - Rebuilding reference field for SalesOrder model...")
|
||||||
|
|
||||||
SalesOrder = apps.get_model('order', 'salesorder')
|
SalesOrder = apps.get_model('order', 'salesorder')
|
||||||
@ -54,7 +53,6 @@ def build_refs(apps, schema_editor):
|
|||||||
order.save()
|
order.save()
|
||||||
|
|
||||||
print(f" - Updated {n} SalesOrder objects")
|
print(f" - Updated {n} SalesOrder objects")
|
||||||
|
|
||||||
print(f" - COMPLETE! -")
|
print(f" - COMPLETE! -")
|
||||||
|
|
||||||
|
|
||||||
|
@ -534,6 +534,12 @@ class SalesOrder(Order):
|
|||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
|
||||||
|
self.rebuild_reference_field()
|
||||||
|
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
||||||
prefix = getSetting('SALESORDER_REFERENCE_PREFIX')
|
prefix = getSetting('SALESORDER_REFERENCE_PREFIX')
|
||||||
|
Loading…
Reference in New Issue
Block a user