mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Pricing bug fix (#4422)
* Control when a new PartPricing object can be created - Prevent this when calling from an on_delete signal - There is an edge case where deleting a part triggers a series of on_delete signals inside an atomic transaction - When the new PartPricing object is created, * Add unit testing: - Ensure PartPricing gets created when a new StockItem is added - Part.delete() works without error - PartPricing instances are deleted also * style fixes
This commit is contained in:
		| @@ -23,7 +23,7 @@ def migrate_currencies(apps, schema_editor): | ||||
|     for the SupplierPriceBreak model, to a new django-money compatible currency. | ||||
|     """ | ||||
|  | ||||
|     logger.info("Updating currency references for SupplierPriceBreak model...") | ||||
|     logger.debug("Updating currency references for SupplierPriceBreak model...") | ||||
|  | ||||
|     # A list of available currency codes | ||||
|     currency_codes = CURRENCIES.keys() | ||||
|   | ||||
| @@ -722,7 +722,7 @@ def after_save_supplier_price(sender, instance, created, **kwargs): | ||||
|     if InvenTree.ready.canAppAccessDatabase() and not InvenTree.ready.isImportingData(): | ||||
|  | ||||
|         if instance.part and instance.part.part: | ||||
|             instance.part.part.schedule_pricing_update() | ||||
|             instance.part.part.schedule_pricing_update(create=True) | ||||
|  | ||||
|  | ||||
| @receiver(post_delete, sender=SupplierPriceBreak, dispatch_uid='post_delete_supplier_price_break') | ||||
| @@ -732,4 +732,4 @@ def after_delete_supplier_price(sender, instance, **kwargs): | ||||
|     if InvenTree.ready.canAppAccessDatabase() and not InvenTree.ready.isImportingData(): | ||||
|  | ||||
|         if instance.part and instance.part.part: | ||||
|             instance.part.part.schedule_pricing_update() | ||||
|             instance.part.part.schedule_pricing_update(create=False) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user