Skip to content

[1.5.x] fix: trigger pricing recalculation when SupplierPart pack_quantity changes (#12421) - #12674

Merged
SchrodingersGat merged 1 commit into
1.5.xfrom
backport/1.5.x/pr-12421
Aug 21, 2026
Merged

SchrodingersGat merged 1 commit into
1.5.xfrom
backport/1.5.x/pr-12421

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from master to 1.5.x:

Questions ?

Please refer to the Backport tool documentation

…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)
@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed pricing Pricing functionality labels Aug 20, 2026
@SchrodingersGat SchrodingersGat added this to the 1.5.2 milestone Aug 20, 2026
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.78%. Comparing base (4a49085) to head (89bad9c).

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           
Flag Coverage Δ
backend 90.76% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.14% <100.00%> (+<0.01%) ⬆️
Backend General 93.56% <ø> (ø)
Frontend 79.72% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit 0ed2c29 into 1.5.x Aug 21, 2026
36 checks passed
@SchrodingersGat
SchrodingersGat deleted the backport/1.5.x/pr-12421 branch August 21, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Identifies a bug which needs to be addressed pricing Pricing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants