Pricing role (#13034)

* add 'pricing' role

* Create new 'pricing' app

- migrate existing pricing models

* bug fixes

* Move API endpoints to /api/pricing/

* Adjust target branch for playwright tests

* Fix permission checks for nested OptionalField entries

* Migrate existing background tasks

* Point to master branch demo data

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
OliverandMatthias Mair authored and GitHub committed 2026-10-21 15:00:50 +11:00
1 parent a91f079530
commit 4c948cda1b
43 files changed
+3175 -1388

No files matched your search

+1
View File
@@ -33,6 +33,7 @@ API schema documentation is split into the following categories:
| [External Order Management](./schema/order.md) | External Order Management |
| [Parts and Part Categories](./schema/part.md) | Parts and Part Categories |
| [Plugin Functionality](./schema/plugins.md) | Plugin Functionality |
| [Pricing Information](./schema/pricing.md) | Part Pricing |
| [Report Generation](./schema/report.md) | Report Generation |
| [Settings Management](./schema/settings.md) | Settings Management |
| [Stock and Stock Locations](./schema/stock.md) | Stock and Stock Locations |
+7
View File
@@ -0,0 +1,7 @@
---
title: Part Pricing
---
The *Part Pricing* section of the InvenTree API schema is documented below.
[OAD(./docs/docs/api/schema/pricing.yml)]
+27
View File
@@ -29,6 +29,33 @@ Additionally, the following information is stored for each part, in relation to
| Sale Price | How much a salable item is sold for (with price-breaks) | [Part](../part/index.md) |
| Sale Cost | How much an item was sold for | [Sales Order](../sales/sales_order.md) |
## Pricing Permissions
Access to part pricing data is controlled by the dedicated *Pricing* [user role](../settings/permissions.md#roles). This role is separate from the *Parts* role, allowing pricing information to be restricted (or granted) independently of general part data. For example, a group may be allowed to view and edit parts, without being able to see what those parts cost.
The *Pricing* role covers the following data:
| Data | Description |
| --- | --- |
| Cached Pricing | The calculated [pricing overview](#pricing-overview) data for each part, including any [pricing overrides](#override-pricing) |
| Sale Price Breaks | The [sale pricing](#sale-pricing) defined for a salable part |
| Internal Price Breaks | The [internal pricing](#internal-pricing) defined for a part |
The permissions within the *Pricing* role apply as follows:
| Permission | Effect |
| --- | --- |
| **View** | View the *Pricing* tab on the part detail page, and see pricing information (e.g. minimum / maximum price) displayed against parts and BOM items |
| **Change** | Edit pricing overrides, manually [refresh](#manual-updates) pricing data, and edit existing price breaks |
| **Add** | Create new sale and internal price breaks |
| **Delete** | Delete sale and internal price breaks |
If a user does not have *view* permission for the *Pricing* role, the *Pricing* tab is hidden on the part detail page, and cached pricing fields are omitted from part and BOM data returned via the API.
!!! info "Other Pricing Sources"
Some of the data used to calculate part pricing is covered by other roles. [Supplier price breaks](../purchasing/supplier.md#supplier-part-pricing) are covered by the *Purchase Orders* role. Within the *Pricing* tab, the *Purchase History* and *Supplier Pricing* sections are only displayed if the user also has *view* permission for the *Purchase Orders* role, and the *Sale Pricing* and *Sale History* sections are only displayed if the user also has *view* permission for the *Sales Orders* role.
## Pricing Tab
The pricing tab for a given Part provides all available pricing information for that part. It shows all price ranges and provides tools to calculate them.
+3
View File
@@ -27,6 +27,9 @@ InvenTree functionality is split into a number of distinct roles. A group will h
{{ roles() }}
!!! info "Pricing Role"
Access to part pricing data is controlled separately from general part data, via the *Pricing* role. Refer to the [pricing permissions](../part/pricing.md#pricing-permissions) documentation for more information.
{{ image("admin/roles.png", "Roles") }}
### Role Permissions