Skip to content

Pricing role - #13034

Merged
SchrodingersGat merged 14 commits into
inventree:masterfrom
SchrodingersGat:pricing-role
Oct 21, 2026
Merged

SchrodingersGat merged 14 commits into
inventree:masterfrom
SchrodingersGat:pricing-role

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Smaller target version of #12524

  • Creates a new "pricing" app
  • Adds new "pricing" permissions role
  • Migrates permissions so any user with "part" role permissions extends automatically to "pricing"
  • Move code into new app

Laying the groundwork for further pricing changes.

Once this is merged, some of the actual functional changes / new features introduced in #12524 can be more cleanly implemented

Required Tasks

@SchrodingersGat SchrodingersGat added this to the 1.7.0 milestone Oct 17, 2026
@SchrodingersGat SchrodingersGat added api Relates to the API pricing Pricing functionality breaking Indicates a major update or change which breaks compatibility labels Oct 17, 2026
@netlify

netlify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit f89dabe
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6ad81a3e1e0ca718d87d01c0

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.70659% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.11%. Comparing base (a91f079) to head (f89dabe).

❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13034      +/-   ##
==========================================
+ Coverage   82.16%   87.11%   +4.94%     
==========================================
  Files        1510     1533      +23     
  Lines      104281   106184    +1903     
  Branches    11541    11863     +322     
==========================================
+ Hits        85682    92497    +6815     
+ Misses      18537    13620    -4917     
- Partials       62       67       +5     
Flag Coverage Δ
backend 92.13% <86.77%> (+0.02%) ⬆️

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

Components Coverage Δ
Backend Apps 92.38% <87.09%> (-0.37%) ⬇️
Backend General 94.50% <ø> (ø)
Frontend 79.40% <66.66%> (+13.51%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Persisted-model migration and authorization changes need human review, with unresolved queue compatibility and nested permission issues.

2 open issues
What changed in this PR

Separates pricing from the parts app, laying the groundwork for future pricing features and independent permissions.

Changes:

  • Moves pricing models, serializers, APIs, and admin views into a dedicated app.
  • Adds a pricing role, permission migration, and frontend access controls.
  • Adds legacy redirects, regression tests, and documentation.
File Description
tasks.py Registers pricing in built-in app tasks.
src/​frontend/​src/​pages/​part/​pricing/​PricingOverviewPanel.tsx Gates pricing actions.
src/​frontend/​src/​pages/​part/​pricing/​PriceBreakPanel.tsx Uses pricing edit permissions.
src/​frontend/​src/​pages/​part/​PartDetail.tsx Gates the pricing tab.
src/​frontend/​lib/​enums/​Roles.tsx Adds the pricing role.
src/​frontend/​lib/​enums/​ApiEndpoints.tsx Updates pricing URLs.
src/​backend/​InvenTree/​users/​test_migrations.py Tests role migration.
src/​backend/​InvenTree/​users/​ruleset.py Maps pricing model permissions.
src/​backend/​InvenTree/​users/​oauth2_scopes.py Adds pricing scopes.
src/​backend/​InvenTree/​users/​migrations/​0019_pricing_role.py Copies existing part permissions.
src/​backend/​InvenTree/​pricing/​test_pricing.py Relocates pricing tests and tests depth logging.
src/​backend/​InvenTree/​pricing/​test_migrations.py Tests data and content-type preservation.
src/​backend/​InvenTree/​pricing/​test_api.py Tests permissions, validation, and redirects.
src/​backend/​InvenTree/​pricing/​serializers.py Relocates serializers and strengthens override validation.
src/​backend/​InvenTree/​pricing/​models.py Relocates pricing models and signals.
src/​backend/​InvenTree/​pricing/​migrations/​0001_initial.py Transfers model state and content types.
src/​backend/​InvenTree/​pricing/​migrations/​__init__.py Initializes migrations package.
src/​backend/​InvenTree/​pricing/​fixtures/​part_pricebreaks.yaml Updates fixture model labels.
src/​backend/​InvenTree/​pricing/​apps.py Defines pricing app configuration.
src/​backend/​InvenTree/​pricing/​api.py Provides dedicated pricing endpoints.
src/​backend/​InvenTree/​pricing/​admin.py Relocates pricing admin views.
src/​backend/​InvenTree/​pricing/​__init__.py Initializes pricing package.
src/​backend/​InvenTree/​part/​test_api.py Updates pricing permission tests.
src/​backend/​InvenTree/​part/​tasks.py Updates pricing model import.
src/​backend/​InvenTree/​part/​serializers.py Adds pricing permission gates.
src/​backend/​InvenTree/​part/​models.py Delegates pricing to the new app.
src/​backend/​InvenTree/​part/​migrations/​0155_move_pricing_models.py Removes old model state without dropping tables.
src/​backend/​InvenTree/​part/​apps.py Updates startup pricing import.
src/​backend/​InvenTree/​part/​api.py Redirects legacy pricing endpoints.
src/​backend/​InvenTree/​part/​admin.py Removes relocated admin views.
src/​backend/​InvenTree/​InvenTree/​urls.py Registers pricing routes.
src/​backend/​InvenTree/​InvenTree/​settings.py Installs pricing app.
src/​backend/​InvenTree/​InvenTree/​api.py Adds method-preserving redirects.
src/​backend/​InvenTree/​InvenTree/​api_version.py Documents API changes.
docs/​extract_schema.py Adds pricing schema category.
docs/​docs/​settings/​permissions.md Links pricing permissions documentation.
docs/​docs/​part/​pricing.md Explains pricing role access.
docs/​docs/​api/​schema/​pricing.md Adds pricing schema page.
docs/​docs/​api/​schema.md Links pricing schema.
.github/​workflows/​frontend.yaml Selects pricing-compatible test data.

Review effort: Balanced

Comment thread src/backend/InvenTree/pricing/models.py Resolved
Comment thread .github/workflows/frontend.yaml Resolved
SchrodingersGat added a commit to inventree/inventree-app that referenced this pull request Oct 20, 2026
* Update pricing role checks

Ref: inventree/InvenTree#13034

* Update release notes
@SchrodingersGat
SchrodingersGat merged commit 4c948cd into inventree:master Oct 21, 2026
63 of 65 checks passed
@SchrodingersGat
SchrodingersGat deleted the pricing-role branch October 21, 2026 04:00
@SchrodingersGat SchrodingersGat mentioned this pull request Oct 30, 2026
carmelom pushed a commit to carmelom/inventree-python that referenced this pull request Nov 10, 2026
- Support PartPricing summary model
- Align with new API structure
- Support legacy API structure too
- Ref: inventree/InvenTree#13034
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility pricing Pricing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants