2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

Add unit test for deleting part which has pricing information (#3986)

* Add unit test for deleting part which has pricing information

* Test delete of part without pricing

* Deal with post_delete errors

1. Deleting a Part deleted related objects (e.g. InternalPriceBreak)
2. post_delete signal is called for InternalPriceBreak
3. Subsequent updates to Part / PartPricing throw error

* Add unit test for deleting a Part via the API

- Add InternalPriceBreak so the previous error condition is checked

* Fix for unit test

* More unit test fixes

(cherry picked from commit fa346257f5)

* Ensure unique part names for unit testing

* Further unit test fixes
This commit is contained in:
Oliver
2022-12-13 11:07:35 +11:00
committed by GitHub
parent 2f7be70287
commit d246169c93
6 changed files with 138 additions and 35 deletions

View File

@ -390,7 +390,7 @@ class PurchaseOrder(Order):
# Schedule pricing update for any referenced parts
for line in self.lines.all():
if line.part and line.part.part:
line.part.part.pricing.schedule_for_update()
line.part.part.schedule_pricing_update()
trigger_event('purchaseorder.completed', id=self.pk)
@ -778,7 +778,7 @@ class SalesOrder(Order):
# Schedule pricing update for any referenced parts
for line in self.lines.all():
line.part.pricing.schedule_for_update()
line.part.schedule_pricing_update()
trigger_event('salesorder.completed', id=self.pk)