Repository navigation
[1.5.x] fix: trigger pricing recalculation when SupplierPart pack_quantity changes (#12421) - #12674
Merged
Merged
Conversation
…anges (#12421) * fix: trigger pricing recalculation when SupplierPart is saved or deleted When a SupplierPart's pack_quantity is updated after price breaks have already been created, the Part's pricing (and BOM cost rollups for any assemblies using that part) was not recalculated. This is because there was no post_save or post_delete signal handler for the SupplierPart model to trigger schedule_pricing_update on the linked Part. Added post_save and post_delete signal handlers for SupplierPart that mirror the existing SupplierPriceBreak signal handlers. The pricing cascade (via update_assemblies) ensures BOM line costs in parent assemblies are also updated. Fixes #12285 * style: fix ruff format issues * style: apply ruff format with --preview flag (matching project config) * fix: resolve PartPricing.DoesNotExist in pack_quantity test The test captured self.part.pricing before any PartPricing row existed, yielding an unsaved instance; the later refresh_from_db() then raised DoesNotExist. Re-fetch self.part.pricing after the price break creates the row, matching the pattern in test_supplier_part_pricing. --------- Co-authored-by: Oliver <[email protected]> Co-authored-by: Aman Jain <[email protected]> (cherry picked from commit be9faff)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.5.x #12674 +/- ##
=======================================
Coverage 86.78% 86.78%
=======================================
Files 1448 1448
Lines 96861 96883 +22
Branches 11267 11267
=======================================
+ Hits 84056 84081 +25
+ Misses 12741 12738 -3
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
masterto1.5.x:Questions ?
Please refer to the Backport tool documentation