Skip to content

Fix auto pricing overwriting manual purchase price #10846 - #11411

Merged
SchrodingersGat merged 4 commits into
inventree:masterfrom
JustusRijke:fix/auto-pricing-overwrites
Feb 24, 2026
Merged

SchrodingersGat merged 4 commits into
inventree:masterfrom
JustusRijke:fix/auto-pricing-overwrites

Conversation

@JustusRijke

Copy link
Copy Markdown
Contributor

Fixes #10846

Changes:

  1. Disable the purchase price input when auto pricing is enabled.
  2. Default auto pricing to false. When the user adds a line item and enables auto pricing, the form remembers this (so when adding another line item, auto pricing will still be enabled).
  3. When editing a line item, auto pricing is always disabled by default to avoid unexpected price recalculation.

What seemed like a simple fix was harder than expected: auto_pricing is a transient serializer flag that defaults to true and gets included in GET responses. The frontend's edit form fetches initial data via GET and treats it as the source of truth, so any local state change gets overwritten by the fetched value on every sync cycle - hope I described this correctly. Setting the auto_pricing flag to false is a bit of a workaround, but it gets the job done, with very little code changes.

IMHO auto_pricing might be better modeled as an action (e.g., a "Calculate price" button) rather than a toggle. This would make intent explicit, avoid state sync issues, and better match the actual data model where auto_pricing is a one-shot request flag, not persistent state. That's a larger UX change, this fix addresses the immediate bug.

@netlify

netlify Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit c10adc0
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/699cf4fdc84e9100085ecda1
😎 Deploy Preview https://deploy-preview-11411--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 89 (🔴 down 4 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@codspeed

codspeed Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 13.44%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 14 improved benchmarks
✅ 30 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime test_api_options_performance[/api/order/po-line/] 154 ms 140.9 ms +9.31%
⚡ WallTime test_api_list_performance[/api/part/] 73.3 ms 69 ms +6.26%
⚡ WallTime test_api_list_performance[/api/build/] 43 ms 39.6 ms +8.66%
⚡ WallTime test_api_list_performance[/api/stock/] 159.2 ms 144.5 ms +10.19%
⚡ WallTime test_search_performance[part] 60.3 ms 56.1 ms +7.49%
⚡ WallTime test_api_options_performance[/api/build/item/] 320.8 ms 292.2 ms +9.79%
⚡ WallTime test_search_performance[build] 35 ms 32.2 ms +8.6%
⚡ WallTime test_search_performance[all] 355.8 ms 327.9 ms +8.5%
⚡ WallTime test_api_options_performance[/api/order/so/] 53.9 ms 49.9 ms +8.14%
⚡ WallTime test_search_performance[supplierpart] 39.3 ms 36.5 ms +7.59%
⚡ WallTime test_api_list_performance[/api/build/item/] 316.6 ms 286.5 ms +10.52%
⚡ WallTime test_search_performance[stockitem] 108 ms 98.7 ms +9.44%
⚡ WallTime test_api_options_performance[/api/build/] 55.5 ms 52.2 ms +6.37%
⚡ WallTime test_api_options_performance[/api/build/line/] 392.4 ms 345.9 ms +13.44%

Comparing JustusRijke:fix/auto-pricing-overwrites (c10adc0) with master (33c5788)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (449bd4e) during the generation of this report, so 33c5788 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@SchrodingersGat

Copy link
Copy Markdown
Member

As you have changed the API schema, you will need to add an entry to ./src/backend/InvenTree/InvenTree/api_version.py

@codecov

codecov Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (449bd4e) to head (c10adc0).
⚠️ Report is 325 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11411      +/-   ##
==========================================
- Coverage   87.99%   87.99%   -0.01%     
==========================================
  Files        1295     1295              
  Lines       58803    58798       -5     
  Branches     1939     1938       -1     
==========================================
- Hits        51742    51737       -5     
  Misses       6579     6579              
  Partials      482      482              
Flag Coverage Δ
backend 89.18% <100.00%> (ø)

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

Components Coverage Δ
Backend Apps 91.69% <ø> (ø)
Backend General 93.37% <ø> (ø)
Frontend 70.82% <ø> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JustusRijke

Copy link
Copy Markdown
Contributor Author

As you have changed the API schema, you will need to add an entry to ./src/backend/InvenTree/InvenTree/api_version.py

Done. Having a hard time getting the tests to run reliably in my devcontainer, so falling back to the GitHub action runners for now

@SchrodingersGat

Copy link
Copy Markdown
Member

@JustusRijke thanks for the contribution!

@SchrodingersGat
SchrodingersGat merged commit 246108e into inventree:master Feb 24, 2026
27 checks passed
jmerro-c3d pushed a commit to jmerro-c3d/InvenTree that referenced this pull request Feb 25, 2026
…nventree#11411)

* Fix auto pricing overwriting manual purchase price inventree#10846

* Added entry to api_version.py

---------

Co-authored-by: Oliver <[email protected]>
@JustusRijke
JustusRijke deleted the fix/auto-pricing-overwrites branch February 27, 2026 18:29
SchrodingersGat added a commit that referenced this pull request Feb 27, 2026
* add "updated_at" field to PurchaseOrder model

* change to use abstract po instead

* add api filters

* add show, order and filter by po updated_at date to frontend

* add tests and increment api_version

* change updated_at to null by default

* never trust github conflict resolution

* bump docker image to python 3.14 (#11414)

* chore(deps): bump the dependencies group across 1 directory with 4 updates (#11416)

Bumps the dependencies group with 4 updates in the / directory: [depot/setup-action](https://github.com/depot/setup-action), [depot/build-push-action](https://github.com/depot/build-push-action), [anchore/sbom-action](https://github.com/anchore/sbom-action) and [actions/stale](https://github.com/actions/stale).


Updates `depot/setup-action` from 1.6.0 to 1.7.1
- [Release notes](https://github.com/depot/setup-action/releases)
- [Commits](depot/setup-action@b0b1ea4...15c09a5)

Updates `depot/build-push-action` from 1.16.2 to 1.17.0
- [Release notes](https://github.com/depot/build-push-action/releases)
- [Commits](depot/build-push-action@9785b13...5f3b3c2)

Updates `anchore/sbom-action` from 0.21.1 to 0.22.2
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](anchore/sbom-action@0b82b0b...28d7154)

Updates `actions/stale` from 10.1.1 to 10.2.0
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@9971854...b5d41d4)

---
updated-dependencies:
- dependency-name: depot/setup-action
  dependency-version: 1.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: depot/build-push-action
  dependency-version: 1.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: anchore/sbom-action
  dependency-version: 0.22.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: actions/stale
  dependency-version: 10.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [UI] Copy cells expansion (#11410)

* Prevent copy button if copy value is null

* Add "link" columns to order tables

* Support copy for default column types

* Tweak padding to avoid flickering issues

* Refactor IPNColumn

* Adjust visual styling

* Copy for SKU and MPN columns

* Add more copy columns

* More tweaks

* Tweak playwright testing

* Further cleanup

* More copy cols

* Fix auto pricing overwriting manual purchase price #10846 (#11411)

* Fix auto pricing overwriting manual purchase price #10846

* Added entry to api_version.py

---------

Co-authored-by: Oliver <[email protected]>

* [UI] Default locale (#11412)

* [UI] Support default server language

* Handle faulty theme

* Add option for default language

* Improve language selection

* Brief docs entry

* Fix typo

* Fix yarn build

* Remove debug msg

* Fix calendar locale

* feat(backend): ensure restore of backups only works in correct enviroments (#11372)

* [FR] ensure restore of backups only works in correct enviroments
Fixes #11214

* update PR nbr

* fix wrong ty detection

* fix link

* ensure tracing does not enagage while running backup ops

* fix import

* remove debugging string

* add error codes

* add tests for backup and restore

* complete test for restore

* we do not need e2e on every matrix entry
there is no realy db dep here

* fix changelog format

* add flag to allow bypass

* update CHANGELOG.md

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Oliver <[email protected]>
Co-authored-by: Matthias Mair <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JustusRijke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Auto Pricing" overwrites manually entered Purchase Price

2 participants