mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 03:00:54 +00:00
Perform a "full_clean" on serialized model
- DRF does not by deault run validate_unique on the model - Need to check if we are "creating" or "updating" a model - Catch and re-throw errors in the correct format - Unit tests
This commit is contained in:
@ -199,7 +199,8 @@ def update_history(apps, schema_editor):
|
||||
update_count += 1
|
||||
|
||||
|
||||
print(f"\n==========================\nUpdated {update_count} StockItemHistory entries")
|
||||
if update_count > 0:
|
||||
print(f"\n==========================\nUpdated {update_count} StockItemHistory entries")
|
||||
|
||||
|
||||
def reverse_update(apps, schema_editor):
|
||||
|
@ -26,7 +26,8 @@ def extract_purchase_price(apps, schema_editor):
|
||||
# Find all the StockItem objects without a purchase_price which point to a PurchaseOrder
|
||||
items = StockItem.objects.filter(purchase_price=None).exclude(purchase_order=None)
|
||||
|
||||
print(f"Found {items.count()} stock items with missing purchase price information")
|
||||
if items.count() > 0:
|
||||
print(f"Found {items.count()} stock items with missing purchase price information")
|
||||
|
||||
update_count = 0
|
||||
|
||||
@ -56,7 +57,8 @@ def extract_purchase_price(apps, schema_editor):
|
||||
|
||||
break
|
||||
|
||||
print(f"Updated pricing for {update_count} stock items")
|
||||
if update_count > 0:
|
||||
print(f"Updated pricing for {update_count} stock items")
|
||||
|
||||
def reverse_operation(apps, schema_editor):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user