Compare commits

..

72 Commits

Author SHA1 Message Date
Oliver 29fa66a75f
Improved error context (#12350)
- More useful error messaging if a task fails
2026-07-10 20:32:35 +10:00
Oliver a1787c659c
Bug fixes for PO receive (#12349)
* Bug fixes for PO receive

- Fix shadowed variable
- Notify listeners for all received items

* Cache part subs
2026-07-10 20:31:57 +10:00
Oliver 83508f4b12
[UI] Page Load Improvements (#12334)
* Parallel initial requests

* Remove debouncing

* Refactor lazy loading of desktop / mobile view

* Reduce initial waiting for loadable components

* Fix duplication of API calls

* Further reduce duplicate calls

* Combine user roles into /user/me/ endpoint

* lazy load global import drawer

* lazy load table in plugin context

* Patch ScanButton

* Added playwright tests for login

* Adjust thresholds
2026-07-10 18:08:25 +10:00
Oliver a38c3963f2
[UI] Form fix (#12348)
* Refactor API form fields

- Prevent reconstruction of all fields when single value changes
- Memoize components more intelligently
- Fix enter key callback ref

* memoize other field types too

* More memo

* Prevent duplicate API calls for related model field

* Add aria-label for IconField

* add playwright tests for form field coverage
2026-07-10 16:54:13 +10:00
Oliver 9fd074b202
Add IPN column to BOM pricing panel (#12344) 2026-07-10 00:21:10 +10:00
Oliver ae12fa342a
Currency options fix (#12343)
- Ensure currency options are loaded dynamically
2026-07-10 00:21:01 +10:00
Oliver d4171f2dcf
[docs] Admin docs (#12345)
* Enhanced documentation for admin center and django-admin

* Fix links and wording

* remove placeholders

* Fix links

* Fix more links
2026-07-10 00:01:00 +10:00
Oliver aec215ca2f
[UI] Docs links (#12342)
* Simplify navigation links

* simplify version.py

* Simplify docs links

* Consolidate
2026-07-10 00:00:34 +10:00
Oliver c9d98cb545
Import internal price (#12341)
* Enable download from frontend panels

* Enable data import for part internal pricing

* Bump API version

* Update CHANGELOG
2026-07-09 23:17:41 +10:00
Oliver 996dbc5aa8
Adjust default behavior of "migrate" command (#12320)
* Adjust default behavior of "migrate" command

- Does not create new migration files automatically

* Add dummy field - ensure detected by CI

* Revert "Add dummy field - ensure detected by CI"

This reverts commit e7a101fe87.

* Fix typo

* Adjust contributing docs

* Add CHANGELOG entry
2026-07-09 20:41:56 +10:00
Oliver d041e251d2
[bug] Plugin load fix (#12329)
* Update plugin name

* Backup accessor for plugin name

* Add null check for plg_db
2026-07-09 10:37:07 +10:00
Petr Ledvina a616e7826c
Fix notes on part creation (#12332)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2026-07-09 08:00:32 +10:00
Oliver 6cc356220f
Fix currency choices for PartPricing model (#12336)
* Fix currency choices for PartPricing model

- Remove dynamic choices from model definition
- Move validation step to the serializer
- Add validator to ensure only valid currencies can be used

* Add regression test

* Bump API version
2026-07-09 06:37:24 +10:00
Oliver 8e555f6b37
[UI] Add form submission shortcut (#12328)
- Ctrl + enter submits the form
2026-07-08 21:14:13 +10:00
Oliver 75f6960782
Robustify playwright tests (#12331)
* Robustify playwright tests

* More test tweaks
2026-07-08 20:31:34 +10:00
Oliver b63d829891
Fix for stocktake exporter (#12324) 2026-07-08 09:06:03 +10:00
Oliver 69ae28d0df
[bug] Barcode bug fix (#12319)
* [bug] Check for null line_item when receiving items

* Additional unit testing

* Additional context

* Fix tests
2026-07-07 13:47:46 +10:00
dependabot[bot] 945f998b48
chore(deps): bump the dependencies group with 4 updates (#12312)
Bumps the dependencies group with 4 updates: [actions/setup-python](https://github.com/actions/setup-python), [actions/cache](https://github.com/actions/cache), [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) and [CodSpeedHQ/action](https://github.com/codspeedhq/action).


Updates `actions/setup-python` from 6.2.0 to 6.3.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](a309ff8b42...ece7cb06ca)

Updates `actions/cache` from 5.0.5 to 6.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](27d5ce7f10...55cc834586)

Updates `stefanzweifel/git-auto-commit-action` from 7.1.0 to 7.2.0
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](04702edda4...4a55954c78)

Updates `CodSpeedHQ/action` from 4.17.6 to 4.18.1
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](63f3e98b61...a4a36bb07c)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: actions/cache
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-version: 7.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.18.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-07 12:10:19 +10:00
github-actions[bot] 77ddc49b3a
New Crowdin translations by GitHub Action (#12284)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-07 10:52:00 +10:00
dependabot[bot] 1124d5ee1e
chore(deps): bump the dependencies group across 1 directory with 31 updates (#12316)
Bumps the dependencies group with 31 updates in the /src/frontend directory:

| Package | From | To |
| --- | --- | --- |
| [@codemirror/language](https://github.com/codemirror/language) | `6.12.3` | `6.12.4` |
| [@codemirror/state](https://github.com/codemirror/state) | `6.6.0` | `6.7.0` |
| [@codemirror/view](https://github.com/codemirror/view) | `6.43.1` | `6.43.4` |
| [@fortawesome/fontawesome-svg-core](https://github.com/FortAwesome/Font-Awesome) | `7.2.0` | `7.3.0` |
| [@fortawesome/free-regular-svg-icons](https://github.com/FortAwesome/Font-Awesome) | `7.2.0` | `7.3.0` |
| [@fortawesome/free-solid-svg-icons](https://github.com/FortAwesome/Font-Awesome) | `7.2.0` | `7.3.0` |
| [@mantine/carousel](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/carousel) | `9.3.2` | `9.4.1` |
| [@mantine/charts](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/charts) | `9.3.2` | `9.4.1` |
| [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `9.3.2` | `9.4.1` |
| [@mantine/dates](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dates) | `9.3.2` | `9.4.1` |
| [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `9.3.2` | `9.4.1` |
| [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `9.3.2` | `9.4.1` |
| [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `9.3.2` | `9.4.1` |
| [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `9.3.2` | `9.4.1` |
| [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `9.3.2` | `9.4.1` |
| [@mantine/spotlight](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/spotlight) | `9.3.2` | `9.4.1` |
| [@mantine/vanilla-extract](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/vanilla-extract) | `9.3.2` | `9.4.1` |
| [@sentry/react](https://github.com/getsentry/sentry-javascript) | `10.58.0` | `10.62.0` |
| [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.101.0` | `5.101.2` |
| [@vanilla-extract/css](https://github.com/vanilla-extract-css/vanilla-extract/tree/HEAD/packages/css) | `1.20.1` | `1.21.0` |
| [mantine-contextmenu](https://github.com/icflorescu/mantine-contextmenu) | `9.3.0` | `9.3.1` |
| [mantine-datatable](https://github.com/icflorescu/mantine-datatable) | `9.3.0` | `9.3.1` |
| [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.79.0` | `7.80.0` |
| [recharts](https://github.com/recharts/recharts) | `3.8.1` | `3.9.0` |
| [styled-components](https://github.com/styled-components/styled-components) | `6.4.2` | `6.4.3` |
| [@flakiness/playwright](https://github.com/flakiness/playwright) | `1.15.0` | `1.16.0` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.61.0` | `1.61.1` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.9.3` | `26.0.1` |
| [@vanilla-extract/vite-plugin](https://github.com/vanilla-extract-css/vanilla-extract/tree/HEAD/packages/vite-plugin) | `5.2.2` | `5.2.3` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `7.3.5` | `7.3.6` |
| [vite-plugin-dts](https://github.com/qmhc/unplugin-dts/tree/HEAD/packages/vite-plugin-dts) | `5.0.2` | `5.0.3` |



Updates `@codemirror/language` from 6.12.3 to 6.12.4
- [Changelog](https://github.com/codemirror/language/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/language/commits)

Updates `@codemirror/state` from 6.6.0 to 6.7.0
- [Changelog](https://github.com/codemirror/state/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/state/commits)

Updates `@codemirror/view` from 6.43.1 to 6.43.4
- [Changelog](https://github.com/codemirror/view/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/view/commits)

Updates `@fortawesome/fontawesome-svg-core` from 7.2.0 to 7.3.0
- [Release notes](https://github.com/FortAwesome/Font-Awesome/releases)
- [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/7.x/CHANGELOG.md)
- [Commits](https://github.com/FortAwesome/Font-Awesome/compare/7.2.0...7.3.0)

Updates `@fortawesome/free-regular-svg-icons` from 7.2.0 to 7.3.0
- [Release notes](https://github.com/FortAwesome/Font-Awesome/releases)
- [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/7.x/CHANGELOG.md)
- [Commits](https://github.com/FortAwesome/Font-Awesome/compare/7.2.0...7.3.0)

Updates `@fortawesome/free-solid-svg-icons` from 7.2.0 to 7.3.0
- [Release notes](https://github.com/FortAwesome/Font-Awesome/releases)
- [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/7.x/CHANGELOG.md)
- [Commits](https://github.com/FortAwesome/Font-Awesome/compare/7.2.0...7.3.0)

Updates `@mantine/carousel` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/carousel)

Updates `@mantine/charts` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/charts)

Updates `@mantine/core` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/core)

Updates `@mantine/dates` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/dates)

Updates `@mantine/dropzone` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/dropzone)

Updates `@mantine/form` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/form)

Updates `@mantine/hooks` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/hooks)

Updates `@mantine/modals` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/modals)

Updates `@mantine/notifications` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/notifications)

Updates `@mantine/spotlight` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/spotlight)

Updates `@mantine/vanilla-extract` from 9.3.2 to 9.4.1
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.4.1/packages/@mantine/vanilla-extract)

Updates `@sentry/react` from 10.58.0 to 10.62.0
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/10.58.0...10.62.0)

Updates `@tanstack/react-query` from 5.101.0 to 5.101.2
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query@5.101.2/packages/react-query)

Updates `@vanilla-extract/css` from 1.20.1 to 1.21.0
- [Release notes](https://github.com/vanilla-extract-css/vanilla-extract/releases)
- [Changelog](https://github.com/vanilla-extract-css/vanilla-extract/blob/master/packages/css/CHANGELOG.md)
- [Commits](https://github.com/vanilla-extract-css/vanilla-extract/commits/@vanilla-extract/css@1.21.0/packages/css)

Updates `mantine-contextmenu` from 9.3.0 to 9.3.1
- [Changelog](https://github.com/icflorescu/mantine-contextmenu/blob/main/CHANGELOG.md)
- [Commits](https://github.com/icflorescu/mantine-contextmenu/commits)

Updates `mantine-datatable` from 9.3.0 to 9.3.1
- [Changelog](https://github.com/icflorescu/mantine-datatable/blob/main/CHANGELOG.md)
- [Commits](https://github.com/icflorescu/mantine-datatable/commits)

Updates `react-hook-form` from 7.79.0 to 7.80.0
- [Release notes](https://github.com/react-hook-form/react-hook-form/releases)
- [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md)
- [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.79.0...v7.80.0)

Updates `recharts` from 3.8.1 to 3.9.0
- [Release notes](https://github.com/recharts/recharts/releases)
- [Changelog](https://github.com/recharts/recharts/blob/main/CHANGELOG.md)
- [Commits](https://github.com/recharts/recharts/compare/v3.8.1...v3.9.0)

Updates `styled-components` from 6.4.2 to 6.4.3
- [Release notes](https://github.com/styled-components/styled-components/releases)
- [Commits](https://github.com/styled-components/styled-components/compare/styled-components@6.4.2...styled-components@6.4.3)

Updates `@flakiness/playwright` from 1.15.0 to 1.16.0
- [Release notes](https://github.com/flakiness/playwright/releases)
- [Commits](https://github.com/flakiness/playwright/compare/v1.15.0...v1.16.0)

Updates `@playwright/test` from 1.61.0 to 1.61.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.61.0...v1.61.1)

Updates `@types/node` from 25.9.3 to 26.0.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@vanilla-extract/vite-plugin` from 5.2.2 to 5.2.3
- [Release notes](https://github.com/vanilla-extract-css/vanilla-extract/releases)
- [Changelog](https://github.com/vanilla-extract-css/vanilla-extract/blob/master/packages/vite-plugin/CHANGELOG.md)
- [Commits](https://github.com/vanilla-extract-css/vanilla-extract/commits/@vanilla-extract/vite-plugin@5.2.3/packages/vite-plugin)

Updates `vite` from 7.3.5 to 7.3.6
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v7.3.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v7.3.6/packages/vite)

Updates `vite-plugin-dts` from 5.0.2 to 5.0.3
- [Release notes](https://github.com/qmhc/unplugin-dts/releases)
- [Changelog](https://github.com/qmhc/unplugin-dts/blob/main/packages/vite-plugin-dts/CHANGELOG.md)
- [Commits](https://github.com/qmhc/unplugin-dts/commits/vite-plugin-dts@5.0.3/packages/vite-plugin-dts)

---
updated-dependencies:
- dependency-name: "@codemirror/language"
  dependency-version: 6.12.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@codemirror/state"
  dependency-version: 6.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@codemirror/view"
  dependency-version: 6.43.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@fortawesome/fontawesome-svg-core"
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@fortawesome/free-regular-svg-icons"
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@fortawesome/free-solid-svg-icons"
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/carousel"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/charts"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/core"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/dates"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/dropzone"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/form"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/hooks"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/modals"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/notifications"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/spotlight"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/vanilla-extract"
  dependency-version: 9.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@sentry/react"
  dependency-version: 10.62.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.101.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@vanilla-extract/css"
  dependency-version: 1.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: mantine-contextmenu
  dependency-version: 9.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: mantine-datatable
  dependency-version: 9.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: react-hook-form
  dependency-version: 7.80.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: recharts
  dependency-version: 3.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: styled-components
  dependency-version: 6.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@flakiness/playwright"
  dependency-version: 1.16.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@playwright/test"
  dependency-version: 1.61.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@types/node"
  dependency-version: 26.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@vanilla-extract/vite-plugin"
  dependency-version: 5.2.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: vite
  dependency-version: 7.3.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: vite-plugin-dts
  dependency-version: 5.0.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-07 09:07:16 +10:00
dependabot[bot] e61f98ec5f
chore(deps): bump python in /contrib/container (#12276)
Bumps python from `44dd044` to `b877e50`.

---
updated-dependencies:
- dependency-name: python
  dependency-version: 3.14.6-slim-trixie
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-07 07:52:04 +10:00
Oliver 99d6f6a817
Table refactor (#12309)
* Refactor table components

- Move underlying components into src/components/tables
- Actual table implementation stay in src/tables

* Fix vite warnings
2026-07-07 00:28:21 +10:00
Oliver f787b81d7f
Add --keep option to setup-test task (#12308)
Allow keeping existing data
2026-07-07 00:06:03 +10:00
Oliver ed62b5d9dd
Pricing bugs (#12305)
* bug fix for get_price method

- Remove unused argument moq
- Allow case where 'multiples' = False

* Error handling for convert_to

* Error handling for PartPricing.save

* Remove unused function

* Revert function definition

* coverage ignore
2026-07-06 22:09:12 +10:00
Oliver 436bfed234
Order click-through on pricing panel (#12307) 2026-07-06 22:09:02 +10:00
Oliver e6a12564f3
[feature] Consumable part (#12295)
* Add "consumable" field to the Part model

* Add frontend integration

* Add badge

* Add docs

* Updated docs

* Add API filtering for new field

* Adjust API filters

* Update backend logic

* Adjust frontend

* Additional unit tests

* Update API version

* update test

* Add consumable icon

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2026-07-06 21:12:24 +10:00
Oliver 47ed86ef9a
[UI] Pricing override (#12306)
* Correct display of pricing overrides

* Add min/max override reference lines

* Fix BarChart component
2026-07-06 20:46:28 +10:00
Matthias Mair c56fe7f612
reduce duplication (#12302) 2026-07-05 14:52:37 +02:00
Miklós Márton 5df2adae6d
Fix OpenAPI multipart file fields to use binary format (#12298)
* Fix OpenAPI multipart file fields to use binary format

Fixes #11246

* Update API version

* fix api version

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2026-07-04 07:58:53 +10:00
Oliver f93c813bb4
[db] Fix for UUID fields (#12301) 2026-07-04 07:57:55 +10:00
Oliver f656ac7263
[docs] Report helper docs (#12300)
* [docs] Report helper docs

* Split out docs for assets and snippets

* Updates
2026-07-03 21:40:28 +10:00
Oliver 4895fbc9fe
[UI] Add "IPN" column to installed items table (#12297) 2026-07-03 19:27:32 +10:00
Oliver 4cb29f37c6
[UI] Snippet editor (#12299)
* Implement admin editor for report snippets

* Report asset management

* Add playwright test for report snippets

* Add playwright test for "Report Assets" panel

* Updated docs
2026-07-03 19:04:50 +10:00
Oliver 15c64d6695
[API] Refactor API for duplicating objects (#12294)
* Implement generic serializer for custom model duplication

* Apply pattern to BuildOrder

* Add more generic options

* Bump API version

* Adjust default option

* Refactor existing implementations

* Dynamic class typing

* Add duplicate field to more model types

- Company
- ManufacturerPart
- SupplierPart
- SalesOrderShipment

* Implement parameter duplication for more models:

- Company
- ManufacturerPart
- SupplierPart

* Simplify code

* Refactor
2026-07-03 18:04:59 +10:00
Matthias Mair 5595a0a52b
fix test assumption (#12296) 2026-07-03 16:46:06 +10:00
dependabot[bot] 2722d5450d
chore(deps): bump the dependencies group across 1 directory with 27 updates (#12260)
* chore(deps): bump the dependencies group across 1 directory with 27 updates

Bumps the dependencies group with 27 updates in the /src/frontend directory:

| Package | From | To |
| --- | --- | --- |
| [@codemirror/search](https://github.com/codemirror/search) | `6.7.0` | `6.7.1` |
| [@fullcalendar/core](https://github.com/fullcalendar/fullcalendar/tree/HEAD/packages/core) | `6.1.20` | `6.1.21` |
| [@fullcalendar/daygrid](https://github.com/fullcalendar/fullcalendar/tree/HEAD/packages/daygrid) | `6.1.20` | `6.1.21` |
| [@fullcalendar/interaction](https://github.com/fullcalendar/fullcalendar/tree/HEAD/packages/interaction) | `6.1.20` | `6.1.21` |
| [@fullcalendar/react](https://github.com/fullcalendar/fullcalendar-react) | `6.1.20` | `6.1.21` |
| [@mantine/carousel](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/carousel) | `9.2.1` | `9.3.2` |
| [@mantine/charts](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/charts) | `9.2.1` | `9.3.2` |
| [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `9.2.1` | `9.3.2` |
| [@mantine/dates](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dates) | `9.2.1` | `9.3.2` |
| [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `9.2.1` | `9.3.2` |
| [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `9.2.1` | `9.3.2` |
| [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `9.2.1` | `9.3.2` |
| [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `9.2.1` | `9.3.2` |
| [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `9.2.1` | `9.3.2` |
| [@mantine/spotlight](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/spotlight) | `9.2.1` | `9.3.2` |
| [@mantine/vanilla-extract](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/vanilla-extract) | `9.2.1` | `9.3.2` |
| [@sentry/react](https://github.com/getsentry/sentry-javascript) | `10.57.0` | `10.58.0` |
| [mantine-contextmenu](https://github.com/icflorescu/mantine-contextmenu) | `9.2.1` | `9.3.0` |
| [mantine-datatable](https://github.com/icflorescu/mantine-datatable) | `9.2.2` | `9.3.0` |
| [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.78.0` | `7.79.0` |
| [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) | `7.29.7` | `8.0.1` |
| [@babel/preset-react](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-react) | `7.29.7` | `8.0.1` |
| [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) | `7.29.7` | `8.0.1` |
| [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) | `7.29.7` | `8.0.0` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.60.0` | `1.61.0` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.9.2` | `25.9.3` |
| [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `5.2.0` | `6.0.2` |



Updates `@codemirror/search` from 6.7.0 to 6.7.1
- [Changelog](https://github.com/codemirror/search/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/search/commits)

Updates `@fullcalendar/core` from 6.1.20 to 6.1.21
- [Release notes](https://github.com/fullcalendar/fullcalendar/releases)
- [Changelog](https://github.com/fullcalendar/fullcalendar/blob/v6.1.21/CHANGELOG.md)
- [Commits](https://github.com/fullcalendar/fullcalendar/commits/v6.1.21/packages/core)

Updates `@fullcalendar/daygrid` from 6.1.20 to 6.1.21
- [Release notes](https://github.com/fullcalendar/fullcalendar/releases)
- [Changelog](https://github.com/fullcalendar/fullcalendar/blob/v6.1.21/CHANGELOG.md)
- [Commits](https://github.com/fullcalendar/fullcalendar/commits/v6.1.21/packages/daygrid)

Updates `@fullcalendar/interaction` from 6.1.20 to 6.1.21
- [Release notes](https://github.com/fullcalendar/fullcalendar/releases)
- [Changelog](https://github.com/fullcalendar/fullcalendar/blob/v6.1.21/CHANGELOG.md)
- [Commits](https://github.com/fullcalendar/fullcalendar/commits/v6.1.21/packages/interaction)

Updates `@fullcalendar/react` from 6.1.20 to 6.1.21
- [Release notes](https://github.com/fullcalendar/fullcalendar-react/releases)
- [Changelog](https://github.com/fullcalendar/fullcalendar-react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fullcalendar/fullcalendar-react/compare/v6.1.20...v6.1.21)

Updates `@mantine/carousel` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/carousel)

Updates `@mantine/charts` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/charts)

Updates `@mantine/core` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/core)

Updates `@mantine/dates` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/dates)

Updates `@mantine/dropzone` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/dropzone)

Updates `@mantine/form` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/form)

Updates `@mantine/hooks` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/hooks)

Updates `@mantine/modals` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/modals)

Updates `@mantine/notifications` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/notifications)

Updates `@mantine/spotlight` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/spotlight)

Updates `@mantine/vanilla-extract` from 9.2.1 to 9.3.2
- [Release notes](https://github.com/mantinedev/mantine/releases)
- [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mantinedev/mantine/commits/9.3.2/packages/@mantine/vanilla-extract)

Updates `@sentry/react` from 10.57.0 to 10.58.0
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/10.57.0...10.58.0)

Updates `mantine-contextmenu` from 9.2.1 to 9.3.0
- [Changelog](https://github.com/icflorescu/mantine-contextmenu/blob/main/CHANGELOG.md)
- [Commits](https://github.com/icflorescu/mantine-contextmenu/commits)

Updates `mantine-datatable` from 9.2.2 to 9.3.0
- [Changelog](https://github.com/icflorescu/mantine-datatable/blob/main/CHANGELOG.md)
- [Commits](https://github.com/icflorescu/mantine-datatable/commits)

Updates `react-hook-form` from 7.78.0 to 7.79.0
- [Release notes](https://github.com/react-hook-form/react-hook-form/releases)
- [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md)
- [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.78.0...v7.79.0)

Updates `@babel/core` from 7.29.7 to 8.0.1
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.0.1/packages/babel-core)

Updates `@babel/preset-react` from 7.29.7 to 8.0.1
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.0.1/packages/babel-preset-react)

Updates `@babel/preset-typescript` from 7.29.7 to 8.0.1
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.0.1/packages/babel-preset-typescript)

Updates `@babel/runtime` from 7.29.7 to 8.0.0
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v8.0.0/packages/babel-runtime)

Updates `@playwright/test` from 1.60.0 to 1.61.0
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.60.0...v1.61.0)

Updates `@types/node` from 25.9.2 to 25.9.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@vitejs/plugin-react` from 5.2.0 to 6.0.2
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@6.0.2/packages/plugin-react)

---
updated-dependencies:
- dependency-name: "@codemirror/search"
  dependency-version: 6.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@fullcalendar/core"
  dependency-version: 6.1.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@fullcalendar/daygrid"
  dependency-version: 6.1.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@fullcalendar/interaction"
  dependency-version: 6.1.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@fullcalendar/react"
  dependency-version: 6.1.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@mantine/carousel"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/charts"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/core"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/dates"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/dropzone"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/form"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/hooks"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/modals"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/notifications"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/spotlight"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@mantine/vanilla-extract"
  dependency-version: 9.3.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@sentry/react"
  dependency-version: 10.58.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: mantine-contextmenu
  dependency-version: 9.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: mantine-datatable
  dependency-version: 9.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: react-hook-form
  dependency-version: 7.79.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@babel/core"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@babel/preset-react"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@babel/preset-typescript"
  dependency-version: 8.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@babel/runtime"
  dependency-version: 8.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: "@playwright/test"
  dependency-version: 1.61.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: "@types/node"
  dependency-version: 25.9.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: "@vitejs/plugin-react"
  dependency-version: 6.0.2
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* lower @vitejs/plugin-react

* fix matching

* temp fix for the non-loading of plugin settings

* remove loading badge for now

* fix test

* make test more precise

* fix syntax

* fix memo issues

* remove wasLoaded hack

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Mair <code@mjmair.com>
2026-07-03 08:30:12 +10:00
Oliver 836a05a104
[UI] Tweak unique keys (#12293)
- Reduce reliance on mutable idx
2026-07-02 20:06:53 +10:00
Oliver 5532946473
[UI] Fix imports (#12292)
- Adjust import structure
- Prevent wall-of-text warnings from vite
2026-07-02 18:28:12 +10:00
Matthias Mair 66d1884ad9
fix pin syntax (#12287)
* fix pin syntax

* make pins precise

* update target name and version
2026-07-02 07:50:05 +10:00
Miklós Márton 6865b0b6e6
Add playwright test for part image upload (#11597) 2026-07-01 22:48:13 +10:00
Oliver 9594ba9a98
Display login errors to user (#12288)
* Improved error message extraction

* Updated playwright test
2026-07-01 22:39:49 +10:00
Oliver 609e5ee105
Check build complete (#12289)
* Display non-field errors in table field

* Refactor validation for build output completion

- Run validation BEFORE trying to complete (serializer validation)
- Refactor and simplify common code

* Adjust unit tests

* Fix typing

* Remove debug
2026-07-01 16:47:33 +10:00
Oliver 09f85aeae9
[UI] Tree select in form fields (#12217)
* Add TreeField component

* Add chevrons in dropdown menu

* Custom node rendering

* Add childIdentifier

* Ensure full value gets displayed

* Fix for search results

* Refactor old renderers

* Override field types

* use definition filters

* Better location validation messages

* Tweaks

* Fix unit test

* Include icon

* Fix playwright test

* Fix call to onValueChange

* Updated playwright tests

* Use pathstring in selectedLabel (if available)

* Mark structural nodes

* Retain selected value when dropdown open

* Add better placeholder values

* Simplify field selection
2026-06-30 22:59:04 +10:00
github-actions[bot] 7a81aa216f
New Crowdin translations by GitHub Action (#12251)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-30 22:27:02 +10:00
Oliver 304c54530c
Allow stock adjustment from "category" detail view (#12256) 2026-06-30 19:28:37 +10:00
Oliver fb280d80e7
Fix for STOCK_COUNT event (#12281)
* Fix for STOCK_COUNT event

- Prevent double emission of event type string

* adjust unit test
2026-06-30 18:54:35 +10:00
Oliver 6111aace1f
[UI] Table field refactor (#12274)
* Use callback funcs

* Don't use idx to identify rows

* Add debug function for finding why a component re-rendered

* Do not pass 'control' through to each row

* Prevent unnecessary re-rendering of table rows

* Adjust order of operations for hooks

* Keep props hidden

* Use lightweight NumberInput

* Use NumberInput elsewhere

* Add comment

* use rowId instead of idx

* Generic row memos

* Compare errors too

* Fix for BomItemSubstituteRow

* Adjust more forms

* memoize quantity

* Memoize build lines

* Fix re-rendering issues for build allocation

* Fix for useConsumeBuildLinesForm

* Fix for transfer order table

* Fix useReceiveLineItems

* Remove memoized pattern

* Fix row keys

* Cleanup

* Create useStockItems hook for memoizing items

* Refactoring

* More refactoring

* Remove obj reference

- preventing shallow comparison from working

* Add error message to useWhyDidYouUpdate

* Cleanup

* Cleanup dead code

* Adjust modal width

* Change attr name

* Remove autoFillFilters prop

* Adjustments for serialized stock

* Fix typing

* Bump frontend version

* Adjustments for playwright testing

* Fix ref issue

* Remove debug entry

* Update CHANGELOG.md

* Reintroduce index to table header

* Refactor common component
2026-06-30 18:10:40 +10:00
Oliver 414aac0224
Fix stocktake bug for counting serialized items (#12280)
* Fix stocktake bug for counting serialized items

* Add unit test
2026-06-30 15:39:05 +10:00
Oliver 635ea8179e
[UI] Fix 'available' display (#12279)
- Hide entirely for items not "in_stock"
2026-06-30 09:53:40 +10:00
dependabot[bot] d00681e20c
chore(deps): bump the dependencies group with 5 updates (#12278)
* chore(deps): bump the dependencies group with 5 updates

Bumps the dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `6.0.3` | `7.0.0` |
| [oasdiff/oasdiff-action/diff](https://github.com/oasdiff/oasdiff-action) | `0.1.1` | `0.1.3` |
| [CodSpeedHQ/action](https://github.com/codspeedhq/action) | `4.17.5` | `4.17.6` |
| [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.5.6` | `0.5.7` |
| [pkgr/action/publish](https://github.com/pkgr/action) | `3bce081ae512c5020856e237d37b3f5479d4aa71` | `c5666febcd31750da6428042193fc5b2fb765435` |


Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](df4cb1c069...9c091bb21b)

Updates `oasdiff/oasdiff-action/diff` from 0.1.1 to 0.1.3
- [Release notes](https://github.com/oasdiff/oasdiff-action/releases)
- [Commits](5fbe96ede8...ccc2442df0)

Updates `CodSpeedHQ/action` from 4.17.5 to 4.17.6
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](c145068895...63f3e98b61)

Updates `zizmorcore/zizmor-action` from 0.5.6 to 0.5.7
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](5f14fd08f7...192e21d79a)

Updates `pkgr/action/publish` from 3bce081ae512c5020856e237d37b3f5479d4aa71 to c5666febcd31750da6428042193fc5b2fb765435
- [Release notes](https://github.com/pkgr/action/releases)
- [Commits](3bce081ae5...c5666febcd)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: dependencies
- dependency-name: oasdiff/oasdiff-action/diff
  dependency-version: 0.1.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.17.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.5.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
- dependency-name: pkgr/action/publish
  dependency-version: c5666febcd31750da6428042193fc5b2fb765435
  dependency-type: direct:production
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checkout action version comment in workflow

* fix pins

* change pin

* fix pin

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Mair <code@mjmair.com>
2026-06-30 08:26:27 +10:00
Oliver f7e267cca8
Fix dashboard issue (#12275) 2026-06-30 00:44:25 +10:00
suzunn 0470dc34b7
fix: preserve supplier import stock workflow (#12215)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2026-06-30 00:24:00 +10:00
Oliver 12825aa1f4
[UI] Fix stock dates (#12272)
* [UI] Fix stock dates

- Display creation date
- Display stocktake date

* Switch to date type
2026-06-29 16:01:33 +10:00
Oliver 5b1a7db07f
[UI] Table tweaks (#12271)
* [UI] Make part cell text copyable

* Reduce text size

* Reduce text size
2026-06-29 16:01:15 +10:00
Matthias Mair 25b83c7388
update sponsored ressources (#12264) 2026-06-27 11:30:51 +10:00
Matthias Mair 2d1d5403d8
chore(backend): Remove devops (#12265)
* update sponsored ressources

* remove az devops
2026-06-27 11:30:28 +10:00
Oliver 1da71ca3b9
[UI] Stock column fix (#12268)
* [UI] Fix StockColumn component

* stock table rendering tweaks
2026-06-27 11:29:40 +10:00
Matthias Mair 56679e4b31
chore(backend): dep bump (#12258)
* general deps bump

* cleanup other dep files
2026-06-26 09:56:01 +10:00
Matthias Mair 5d581a35e4
chore(backend): harden gh setup (#12262)
* pin plugin creator version

* hard pin install script
2026-06-26 09:55:36 +10:00
Matthias Mair 8f73d9291b
chore(backend): typing fixes (#12247)
* bump ty

* various fixes

* fix settings

* bump stubs

* update pre-commit setup

* update ignore

* fix various issues

* fix style

* fix ignores

* fix wrong ty warnings

* ignore __class__ type checking errors
see https://github.com/astral-sh/ty/issues/3122

* fix exception logging

* update ignoring

* bump ty further

* add cleanup cmd

* Merge branch 'master' of https://github.com/inventree/InvenTree into typechecking-remove-ignore

* bump ty

* remove now unused class ignores
2026-06-26 08:04:36 +10:00
Oliver e847d96a88
Bug fix for exception handler (#12257) 2026-06-26 08:02:38 +10:00
Oliver b99b80957f
[UI] Improve revision selector (#12254)
- Display upstream revisions too
2026-06-26 00:02:50 +10:00
Oliver 39b74c7e87
Skip "many" fields in DataExport (#12255)
- Exporting multi-dimensional datasets requires a custom exporter
2026-06-25 22:44:32 +10:00
Matthias Mair 496b20e08f
fix js-yaml, esbuild vulns (#12190)
* fix js-yaml, esbuild vulns

* update bump

* upgrade vite
2026-06-25 16:06:02 +10:00
Oliver e5fa67ca9f
Project code active (#12250)
* Add 'active' field to the ProjectCode model

- Allows retiring of old project codes without deleting

* Update UI table

* Refactor ProjectCodeField

* Add unit test

* Bump API version and CHANGELOG
2026-06-25 14:26:53 +10:00
Oliver 3f36537391
Revert devcontainer to python 3.12 (#12249) 2026-06-25 12:23:44 +10:00
github-actions[bot] d1f91e8b4e
New Crowdin translations by GitHub Action (#12238)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-25 10:51:57 +10:00
Neil Beukes 4cfefc18c1
Allow stock transfer to merge into existing stock (optional) #6951 (#12022)
* working on merge transfer

* fix history when merging

* update messaging, add 'added' line in history

* reworked history logic

* removed old transfer logic

* remove formatting changes from vite file

* Bumped API version, added entry in docs for new global setting

* removed the tracking item overwrite, Use existing tracking event from transfer

* run pre-commit checks

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2026-06-25 00:24:33 +10:00
Oliver fa55917659
Update devcontainer Dockerfile (#12244)
- Update to python 3.14
- Fix base packages
2026-06-24 21:56:39 +10:00
Matthias Mair de736ee5de
!feat(backend): bump minimum python version (#12223)
* bump ci versions

* bump installer version

* bump tooling version ref

* bump doc refs

* bump / refactor code refs

* bump debug ref

* remove now unneeded deps

* bump release version

* remove distutils

* fix finder call

* remove old compat code

* add changelog entry

* lower cov target for now
2026-06-24 17:42:35 +10:00
Oliver 09f11a27d9
[report] Tweak datamatrix helper (#12240)
* [report] Tweak datamatrix helper

- Add support for "rectangular" display
- Support different image output formats

* Fix unit tests
2026-06-24 17:42:32 +10:00
Oliver 7e59c92422
1.5.0 (#12239)
* Add release entry for 1.4.0

* Add blank entry for 1.5.0

* Bump version to 1.5.0 dev
2026-06-24 13:53:58 +10:00
408 changed files with 150763 additions and 140771 deletions

View File

@ -1,9 +1,7 @@
# Dockerfile for the InvenTree devcontainer # Dockerfile for the InvenTree devcontainer
# This container is used for development of the InvenTree project, and includes all necessary dependencies for both backend and frontend development.
# In contrast with the "production" image (which is based on an Alpine image) FROM mcr.microsoft.com/devcontainers/python:3.12-trixie@sha256:5440cb68898d190ad6c6e8a4634ce89d0645bea47f9c8beb75612bb8e3983711
# we use a Debian-based image for the devcontainer
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm@sha256:e754c29c4e3ffcf6c794c1020e36a0812341d88ec9569a34704b975fa89e8848
# InvenTree paths # InvenTree paths
ENV INVENTREE_HOME="/home/inventree" ENV INVENTREE_HOME="/home/inventree"
@ -25,10 +23,10 @@ RUN chmod +x init.sh
# Install required base packages # Install required base packages
RUN apt update && apt install -y \ RUN apt update && apt install -y \
python3.11-dev python3.11-venv \ python3-dev python3-venv \
postgresql-client \ postgresql-client \
libldap2-dev libsasl2-dev \ libldap2-dev libsasl2-dev \
libpango1.0-0 libcairo2 \ libpango-1.0-0 libcairo2 \
poppler-utils weasyprint poppler-utils weasyprint
# Install packages required for frontend development # Install packages required for frontend development

View File

@ -1,79 +0,0 @@
trigger:
batch: true
branches:
include:
- master
- stable
- refs/tags/*
paths:
include:
- src/backend
pool:
vmImage: ubuntu-latest
strategy:
matrix:
Python39:
PYTHON_VERSION: '3.11'
maxParallel: 3
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'
- task: PythonScript@0
displayName: 'Export project path'
inputs:
scriptSource: 'inline'
script: |
"""Search all subdirectories for `manage.py`."""
from glob import iglob
from os import path
# Python >= 3.5
manage_py = next(iglob(path.join('**', 'manage.py'), recursive=True), None)
if not manage_py:
raise SystemExit('Could not find a Django project')
project_location = path.dirname(path.abspath(manage_py))
print('Found Django project in', project_location)
print('##vso[task.setvariable variable=projectRoot]{}'.format(project_location))
- script: |
python -m pip install --upgrade pip setuptools wheel uv
uv pip install --require-hashes -r src/backend/requirements.txt
uv pip install --require-hashes -r src/backend/requirements-dev.txt
sudo apt-get install poppler-utils
sudo apt-get install libpoppler-dev
uv pip install unittest-xml-reporting coverage invoke
displayName: 'Install prerequisites'
env:
UV_SYSTEM_PYTHON: 1
- script: |
pushd '$(projectRoot)'
invoke update --uv
coverage run manage.py test --testrunner xmlrunner.extra.djangotestrunner.XMLTestRunner --no-input
coverage xml -i
displayName: 'Run tests'
env:
INVENTREE_DB_ENGINE: sqlite3
INVENTREE_DB_NAME: inventree
INVENTREE_MEDIA_ROOT: ./media
INVENTREE_STATIC_ROOT: ./static
INVENTREE_BACKUP_DIR: ./backup
INVENTREE_SITE_URL: http://localhost:8000
INVENTREE_PLUGINS_ENABLED: true
UV_SYSTEM_PYTHON: 1
INVENTREE_DEBUG: true
INVENTREE_LOG_LEVEL: INFO
- task: PublishTestResults@2
inputs:
testResultsFiles: "**/TEST-*.xml"
testRunTitle: 'Python $(PYTHON_VERSION)'
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@2
inputs:
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'

View File

@ -39,14 +39,14 @@ runs:
using: 'composite' using: 'composite'
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
persist-credentials: false persist-credentials: false
# Python installs # Python installs
- name: Set up Python ${{ env.python_version }} - name: Set up Python ${{ env.python_version }}
if: ${{ inputs.python == 'true' && env.python_version != '3.14' }} if: ${{ inputs.python == 'true' && env.python_version != '3.14' }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # pin@v5.0.0 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with: with:
python-version: ${{ env.python_version }} python-version: ${{ env.python_version }}
cache: pip cache: pip
@ -57,7 +57,7 @@ runs:
contrib/dev_reqs/requirements.txt contrib/dev_reqs/requirements.txt
- name: Setup Python 3.14 - name: Setup Python 3.14
if: ${{ inputs.python == 'true' && env.python_version == '3.14' }} if: ${{ inputs.python == 'true' && env.python_version == '3.14' }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # pin@v5.0.0 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with: with:
python-version: ${{ env.python_version }} python-version: ${{ env.python_version }}
- name: Install Base Python Dependencies - name: Install Base Python Dependencies

View File

@ -25,7 +25,7 @@ jobs:
) )
steps: steps:
- name: Backport Action - name: Backport Action
uses: sqren/backport-github-action@ad888e978060bc1b2798690dd9d03c4036560947 # pin@v9.2.2 uses: sorenlouv/backport-github-action@8a6c0381851f43f9f1fddc7303f0e9015eb57b62 # v12.0.4
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
auto_backport_label_prefix: backport-to- auto_backport_label_prefix: backport-to-

View File

@ -9,7 +9,7 @@ on:
- l10 - l10
env: env:
python_version: 3.11 python_version: 3.12
permissions: permissions:
contents: read contents: read
@ -31,7 +31,7 @@ jobs:
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
@ -46,4 +46,6 @@ jobs:
run: | run: |
python ./.github/scripts/check_source_strings.py --frontend --backend python ./.github/scripts/check_source_strings.py --frontend --backend
- name: Check Migration Files - name: Check Migration Files
run: python3 .github/scripts/check_migration_files.py run: |
invoke migrate --detect
python3 .github/scripts/check_migration_files.py

View File

@ -39,10 +39,10 @@ jobs:
docker: ${{ steps.filter.outputs.docker }} docker: ${{ steps.filter.outputs.docker }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # pin@v4.0.1 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter id: filter
with: with:
filters: | filters: |
@ -62,12 +62,12 @@ jobs:
contents: read contents: read
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python_version: "3.11" python_version: 3.12
runs-on: ubuntu-latest # in the future we can try to use alternative runners here runs-on: ubuntu-latest # in the future we can try to use alternative runners here
steps: steps:
- name: Check out repo - name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Test Docker Image - name: Test Docker Image
@ -134,12 +134,12 @@ jobs:
contents: read contents: read
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python_version: "3.11" python_version: 3.12
runs-on: ubuntu-latest # in the future we can try to use alternative runners here runs-on: ubuntu-latest # in the future we can try to use alternative runners here
steps: steps:
- name: Check out repo - name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Run Migration Tests - name: Run Migration Tests
@ -158,16 +158,16 @@ jobs:
id-token: write id-token: write
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python_version: "3.11" python_version: 3.12
runs-on: ubuntu-latest # in the future we can try to use alternative runners here runs-on: ubuntu-latest # in the future we can try to use alternative runners here
steps: steps:
- name: Check out repo - name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Set Up Python ${{ env.python_version }} - name: Set Up Python ${{ env.python_version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # pin@v6.2.0 uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with: with:
python-version: ${{ env.python_version }} python-version: ${{ env.python_version }}
- name: Version Check - name: Version Check
@ -178,13 +178,13 @@ jobs:
echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV
- name: Set up QEMU - name: Set up QEMU
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # pin@v4.1.0 uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # pin@v4.1.0 uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Set up cosign - name: Set up cosign
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # pin@v4.1.2 uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
- name: Check if Dockerhub login is required - name: Check if Dockerhub login is required
id: docker_login id: docker_login
run: | run: |
@ -195,14 +195,14 @@ jobs:
fi fi
- name: Login to Dockerhub - name: Login to Dockerhub
if: github.event_name != 'pull_request' && steps.docker_login.outputs.skip_dockerhub_login != 'true' if: github.event_name != 'pull_request' && steps.docker_login.outputs.skip_dockerhub_login != 'true'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # pin@v4.2.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log into registry ghcr.io - name: Log into registry ghcr.io
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # pin@v4.2.0 uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@ -211,16 +211,16 @@ jobs:
- name: Extract Docker metadata - name: Extract Docker metadata
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
id: meta id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # pin@v6.1.0 uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with: with:
images: | images: |
inventree/inventree inventree/inventree
ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}
- uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # pin@v1 - uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1
- name: Push Docker Images - name: Push Docker Images
id: push-docker id: push-docker
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # pin@v1 uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # v1
with: with:
project: jczzbjkk68 project: jczzbjkk68
context: . context: .

View File

@ -8,13 +8,14 @@ name: Frontend
on: on:
push: push:
branches-ignore: ["l10*", "dependabot/*", "backport/*"] branches-ignore: ["l10*", "dependabot/**", "backport/**"]
pull_request: pull_request:
branches-ignore: ["l10*"] branches-ignore: ["l10*"]
env: env:
python_version: 3.11 python_version: 3.12
node_version: 24 node_version: 24
plugin_creator_version: 1.20.0
# The OS version must be set per job # The OS version must be set per job
server_start_sleep: 60 server_start_sleep: 60
@ -45,10 +46,10 @@ jobs:
force: ${{ steps.force.outputs.force }} force: ${{ steps.force.outputs.force }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # pin@v4.0.1 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter id: filter
with: with:
filters: | filters: |
@ -68,7 +69,7 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -85,7 +86,7 @@ jobs:
run: | run: |
cd src/backend/InvenTree/web/static cd src/backend/InvenTree/web/static
zip -r frontend-build.zip web/ web/.vite zip -r frontend-build.zip web/ web/.vite
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: frontend-build name: frontend-build
path: src/backend/InvenTree/web/static/web path: src/backend/InvenTree/web/static/web
@ -122,7 +123,7 @@ jobs:
VITE_COVERAGE: false VITE_COVERAGE: false
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -140,7 +141,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: invoke int.frontend-compile --extract run: invoke int.frontend-compile --extract
- name: Cache Playwright browsers - name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # pin@v5.0.5 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: playwright-cache id: playwright-cache
with: with:
path: ~/.cache/ms-playwright path: ~/.cache/ms-playwright
@ -153,7 +154,7 @@ jobs:
run: cd src/frontend && npx playwright install-deps run: cd src/frontend && npx playwright install-deps
- name: Install Sample Plugin - name: Install Sample Plugin
run: | run: |
pip install -U inventree-plugin-creator pip install -U inventree-plugin-creator==${{ env.plugin_creator_version }}
create-inventree-plugin --default create-inventree-plugin --default
cd MyCustomPlugin && pip install -e . && cd frontend && npm install && npm run translate && npm run build cd MyCustomPlugin && pip install -e . && cd frontend && npm install && npm run translate && npm run build
- name: Run Playwright tests - name: Run Playwright tests
@ -164,7 +165,7 @@ jobs:
cp ./tests/fixtures/playwright_custom_splash.png ../backend/InvenTree/InvenTree/static/img/playwright_custom_splash.png cp ./tests/fixtures/playwright_custom_splash.png ../backend/InvenTree/InvenTree/static/img/playwright_custom_splash.png
invoke static invoke static
env INVENTREE_CUSTOM_SPLASH="img/playwright_custom_splash.png" INVENTREE_CUSTOM_LOGO="img/playwright_custom_logo.png" PLAYWRIGHT_BASE_URL=http://localhost:8000 npx playwright test --project=firefox --shard=${{ matrix.shard }}/2 env INVENTREE_CUSTOM_SPLASH="img/playwright_custom_splash.png" INVENTREE_CUSTOM_LOGO="img/playwright_custom_logo.png" PLAYWRIGHT_BASE_URL=http://localhost:8000 npx playwright test --project=firefox --shard=${{ matrix.shard }}/2
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.tests.outcome == 'failure' }} if: ${{ !cancelled() && steps.tests.outcome == 'failure' }}
with: with:
name: playwright-report-firefox-${{ matrix.shard }} name: playwright-report-firefox-${{ matrix.shard }}
@ -204,7 +205,7 @@ jobs:
VITE_COVERAGE: true VITE_COVERAGE: true
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -222,7 +223,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: invoke int.frontend-compile --extract run: invoke int.frontend-compile --extract
- name: Cache Playwright browsers - name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # pin@v5.0.5 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: playwright-cache id: playwright-cache
with: with:
path: ~/.cache/ms-playwright path: ~/.cache/ms-playwright
@ -235,7 +236,7 @@ jobs:
run: cd src/frontend && npx playwright install-deps run: cd src/frontend && npx playwright install-deps
- name: Install Sample Plugin - name: Install Sample Plugin
run: | run: |
pip install -U inventree-plugin-creator pip install -U inventree-plugin-creator==${{ env.plugin_creator_version }}
create-inventree-plugin --default create-inventree-plugin --default
cd MyCustomPlugin && pip install -e . && cd frontend && npm install && npm run translate && npm run build cd MyCustomPlugin && pip install -e . && cd frontend && npm install && npm run translate && npm run build
- name: Playwright [${{ matrix.shard }} / 4] - name: Playwright [${{ matrix.shard }} / 4]
@ -244,7 +245,7 @@ jobs:
cd src/frontend cd src/frontend
npx nyc playwright test --project=chromium --shard=${{ matrix.shard }}/4 npx nyc playwright test --project=chromium --shard=${{ matrix.shard }}/4
- name: Playwright Report [${{ matrix.shard }} / 4] - name: Playwright Report [${{ matrix.shard }} / 4]
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() && steps.tests.outcome == 'failure' }} if: ${{ !cancelled() && steps.tests.outcome == 'failure' }}
with: with:
name: playwright-report-chromium-${{ matrix.shard }} name: playwright-report-chromium-${{ matrix.shard }}
@ -252,7 +253,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
retention-days: 7 retention-days: 7
- name: Upload Coverage Artifact [${{ matrix.shard }} / 4] - name: Upload Coverage Artifact [${{ matrix.shard }} / 4]
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
id: coverage-upload id: coverage-upload
if: ${{ !cancelled() && steps.tests.outcome != 'failure' }} if: ${{ !cancelled() && steps.tests.outcome != 'failure' }}
with: with:
@ -272,7 +273,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
@ -284,7 +285,7 @@ jobs:
update: false update: false
- name: Download Coverage Artifacts - name: Download Coverage Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # pin@v8.0.1 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: with:
pattern: coverage-* pattern: coverage-*
path: all-coverage/ path: all-coverage/
@ -303,7 +304,7 @@ jobs:
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
if: ${{ !cancelled() && github.ref == 'refs/heads/master' }} if: ${{ !cancelled() && github.ref == 'refs/heads/master' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # pin@v7.0.0 uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
slug: inventree/InvenTree slug: inventree/InvenTree

View File

@ -7,7 +7,7 @@ name: Import / Export
on: on:
push: push:
branches-ignore: ["l10*", "dependabot/*", "backport/*"] branches-ignore: ["l10*", "dependabot/**", "backport/**"]
pull_request: pull_request:
branches-ignore: ["l10*"] branches-ignore: ["l10*"]
@ -15,7 +15,7 @@ permissions:
contents: read contents: read
env: env:
python_version: 3.11 python_version: 3.12
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -48,10 +48,10 @@ jobs:
outputs: outputs:
server: ${{ steps.filter.outputs.server }} server: ${{ steps.filter.outputs.server }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # pin@v4.0.1 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter id: filter
with: with:
filters: | filters: |
@ -76,7 +76,7 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false

View File

@ -4,12 +4,12 @@ name: QC
on: on:
push: push:
branches-ignore: ["l10*", "dependabot/*", "backport/*"] branches-ignore: ["l10*", "dependabot/**", "backport/**"]
pull_request: pull_request:
branches-ignore: ["l10*"] branches-ignore: ["l10*"]
env: env:
python_version: 3.11 python_version: 3.12
node_version: 24 node_version: 24
# The OS version must be set per job # The OS version must be set per job
server_start_sleep: 60 server_start_sleep: 60
@ -44,10 +44,10 @@ jobs:
submit-performance: ${{ steps.runner-perf.outputs.submit-performance }} submit-performance: ${{ steps.runner-perf.outputs.submit-performance }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # pin@v4.0.1 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter id: filter
with: with:
filters: | filters: |
@ -108,16 +108,16 @@ jobs:
if: needs.paths-filter.outputs.cicd == 'true' || needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.frontend == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true' if: needs.paths-filter.outputs.cicd == 'true' || needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.frontend == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true'
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Set up Python ${{ env.python_version }} - name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # pin@v6.2.0 uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with: with:
python-version: ${{ env.python_version }} python-version: ${{ env.python_version }}
cache: "pip" cache: "pip"
- name: Run pre commit hook Checks - name: Run pre commit hook Checks
uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # pin@v2 uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d # v2.0.5
- name: Check Version - name: Check Version
run: | run: |
pip install --require-hashes -r contrib/dev_reqs/requirements.txt pip install --require-hashes -r contrib/dev_reqs/requirements.txt
@ -130,7 +130,7 @@ jobs:
if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true' if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true'
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -152,11 +152,11 @@ jobs:
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Set up Python ${{ env.python_version }} - name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # pin@v6.2.0 uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with: with:
python-version: ${{ env.python_version }} python-version: ${{ env.python_version }}
- name: Check Config - name: Check Config
@ -165,7 +165,7 @@ jobs:
pip install --require-hashes -r docs/requirements.txt pip install --require-hashes -r docs/requirements.txt
python docs/ci/check_mkdocs_config.py python docs/ci/check_mkdocs_config.py
- name: Check Links - name: Check Links
uses: tcort/github-action-markdown-link-check@e7c7a18363c842693fadde5d41a3bd3573a7a225 # pin@v1 uses: tcort/github-action-markdown-link-check@e7c7a18363c842693fadde5d41a3bd3573a7a225 # v1
with: with:
folder-path: docs folder-path: docs
config-file: docs/mlc_config.json config-file: docs/mlc_config.json
@ -190,7 +190,7 @@ jobs:
version: ${{ steps.version.outputs.version }} version: ${{ steps.version.outputs.version }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -202,7 +202,7 @@ jobs:
- name: Export API Documentation - name: Export API Documentation
run: invoke dev.schema --ignore-warnings --filename src/backend/InvenTree/schema.yml run: invoke dev.schema --ignore-warnings --filename src/backend/InvenTree/schema.yml
- name: Upload schema - name: Upload schema
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: schema.yml name: schema.yml
path: src/backend/InvenTree/schema.yml path: src/backend/InvenTree/schema.yml
@ -222,7 +222,7 @@ jobs:
echo "Downloaded api.yaml" echo "Downloaded api.yaml"
- name: Running OpenAPI Spec diff action - name: Running OpenAPI Spec diff action
id: breaking_changes id: breaking_changes
uses: oasdiff/oasdiff-action/diff@5fbe96ede8d0c53aeadef122d7a0abb79152d493 # pin@main uses: oasdiff/oasdiff-action/diff@3e9d440d37f468355457604348009f50e0cddbf3 # v0.1.4
with: with:
base: "api.yaml" base: "api.yaml"
revision: "src/backend/InvenTree/schema.yml" revision: "src/backend/InvenTree/schema.yml"
@ -251,17 +251,17 @@ jobs:
- name: Extract settings / tags - name: Extract settings / tags
run: invoke int.export-definitions --basedir docs run: invoke int.export-definitions --basedir docs
- name: Upload settings - name: Upload settings
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: inventree_settings.json name: inventree_settings.json
path: docs/generated/inventree_settings.json path: docs/generated/inventree_settings.json
- name: Upload tags - name: Upload tags
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: inventree_tags.yml name: inventree_tags.yml
path: docs/generated/inventree_tags.yml path: docs/generated/inventree_tags.yml
- name: Upload filters - name: Upload filters
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: inventree_filters.yml name: inventree_filters.yml
path: docs/generated/inventree_filters.yml path: docs/generated/inventree_filters.yml
@ -275,7 +275,7 @@ jobs:
version: ${{ needs.schema.outputs.version }} version: ${{ needs.schema.outputs.version }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
name: Checkout Code name: Checkout Code
with: with:
repository: inventree/schema repository: inventree/schema
@ -284,7 +284,7 @@ jobs:
- name: Create artifact directory - name: Create artifact directory
run: mkdir -p artifact run: mkdir -p artifact
- name: Download schema artifact - name: Download schema artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # pin@v8.0.1 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: with:
path: artifact path: artifact
merge-multiple: true merge-multiple: true
@ -301,7 +301,7 @@ jobs:
echo "after move" echo "after move"
ls -la artifact ls -la artifact
rm -rf artifact rm -rf artifact
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # pin@v7.1.0 - uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v7.2.0
name: Commit schema changes name: Commit schema changes
with: with:
commit_message: "Update API schema for ${{ env.version }} / ${{ github.sha }}" commit_message: "Update API schema for ${{ env.version }} / ${{ github.sha }}"
@ -332,7 +332,7 @@ jobs:
node_version: '>=24' node_version: '>=24'
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -363,7 +363,7 @@ jobs:
pip install . pip install .
if: needs.paths-filter.outputs.submit-performance == 'true' if: needs.paths-filter.outputs.submit-performance == 'true'
- name: Performance Reporting - name: Performance Reporting
uses: CodSpeedHQ/action@c145068895e045cc725ee76fcd2307624b65c3af # pin@v4.17.5 uses: CodSpeedHQ/action@a4a36bb07c0638b0b4ca52bf1f3dad1b4289e52f # v4.18.1
# check if we are in inventree/inventree - reporting only works in that OIDC context # check if we are in inventree/inventree - reporting only works in that OIDC context
if: github.repository == 'inventree/InvenTree' && needs.paths-filter.outputs.submit-performance == 'true' if: github.repository == 'inventree/InvenTree' && needs.paths-filter.outputs.submit-performance == 'true'
with: with:
@ -379,7 +379,7 @@ jobs:
continue-on-error: true # continue if a step fails so that coverage gets pushed continue-on-error: true # continue if a step fails so that coverage gets pushed
strategy: strategy:
matrix: matrix:
python_version: [3.11, 3.14] python_version: [3.12, 3.14]
env: env:
INVENTREE_DB_NAME: ./inventree.sqlite INVENTREE_DB_NAME: ./inventree.sqlite
@ -390,7 +390,7 @@ jobs:
python_version: ${{ matrix.python_version }} python_version: ${{ matrix.python_version }}
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -405,17 +405,19 @@ jobs:
- name: Test Translations - name: Test Translations
run: invoke dev.translate run: invoke dev.translate
- name: Check Migration Files - name: Check Migration Files
run: python3 .github/scripts/check_migration_files.py run: |
invoke migrate --detect
python3 .github/scripts/check_migration_files.py
- name: Coverage Tests - name: Coverage Tests
run: invoke dev.test --check --coverage --translations run: invoke dev.test --check --coverage --translations
- name: Upload raw coverage to artifacts - name: Upload raw coverage to artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: coverage name: coverage
path: .coverage path: .coverage
retention-days: 14 retention-days: 14
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # pin@v7.0.0 uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
if: always() if: always()
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
@ -441,7 +443,7 @@ jobs:
INVENTREE_AUTO_UPDATE: true INVENTREE_AUTO_UPDATE: true
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -454,7 +456,7 @@ jobs:
env: env:
node_version: '>=24' node_version: '>=24'
- name: Performance Reporting - name: Performance Reporting
uses: CodSpeedHQ/action@c145068895e045cc725ee76fcd2307624b65c3af # pin@v4.17.5 uses: CodSpeedHQ/action@a4a36bb07c0638b0b4ca52bf1f3dad1b4289e52f # v4.18.1
with: with:
mode: walltime mode: walltime
run: inv dev.test --pytest run: inv dev.test --pytest
@ -492,7 +494,7 @@ jobs:
- 6379:6379 - 6379:6379
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -541,7 +543,7 @@ jobs:
- 3306:3306 - 3306:3306
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -584,7 +586,7 @@ jobs:
- 5432:5432 - 5432:5432
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -597,7 +599,7 @@ jobs:
- name: Run Tests - name: Run Tests
run: invoke dev.test --check --migrations --report --coverage --translations run: invoke dev.test --check --migrations --report --coverage --translations
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # pin@v7.0.0 uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
if: always() if: always()
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
@ -618,7 +620,7 @@ jobs:
INVENTREE_PLUGINS_ENABLED: false INVENTREE_PLUGINS_ENABLED: false
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
name: Checkout Code name: Checkout Code
@ -674,8 +676,8 @@ jobs:
security-events: write security-events: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Run zizmor 🌈 - name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6 uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7

View File

@ -7,7 +7,7 @@ on:
permissions: permissions:
contents: read contents: read
env: env:
python_version: 3.11 python_version: 3.12
jobs: jobs:
stable: stable:
@ -20,7 +20,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Version Check - name: Version Check
@ -28,7 +28,7 @@ jobs:
pip install --require-hashes -r contrib/dev_reqs/requirements.txt pip install --require-hashes -r contrib/dev_reqs/requirements.txt
python3 .github/scripts/version_check.py python3 .github/scripts/version_check.py
- name: Push to Stable Branch - name: Push to Stable Branch
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # pin@v1.3.0 uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v1.3.0
if: env.stable_release == 'true' if: env.stable_release == 'true'
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
@ -45,7 +45,7 @@ jobs:
artifact-metadata: write artifact-metadata: write
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -57,7 +57,7 @@ jobs:
- name: Build frontend - name: Build frontend
run: cd src/frontend && npm run compile && npm run build run: cd src/frontend && npm run compile && npm run build
- name: Create SBOM for frontend - name: Create SBOM for frontend
uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # pin@v0 uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0
with: with:
artifact-name: frontend-build.spdx artifact-name: frontend-build.spdx
path: src/frontend path: src/frontend
@ -75,7 +75,7 @@ jobs:
zip -r ../frontend-build.zip * .vite zip -r ../frontend-build.zip * .vite
- name: Attest Build Provenance - name: Attest Build Provenance
id: attest id: attest
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # pin@v4 uses: actions/attest@a1948c3f048ba23858d222213b7c278aabede763 # v4.1.1
with: with:
subject-path: "${{ github.workspace }}/src/backend/InvenTree/web/static/frontend-build.zip" subject-path: "${{ github.workspace }}/src/backend/InvenTree/web/static/frontend-build.zip"
@ -85,7 +85,7 @@ jobs:
REF: ${{ github.ref_name }} REF: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload frontend to artifacts - name: Upload frontend to artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7.0.1 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: frontend-build name: frontend-build
path: src/backend/InvenTree/web/static/frontend-build.zip path: src/backend/InvenTree/web/static/frontend-build.zip
@ -115,7 +115,7 @@ jobs:
INVENTREE_DEBUG: true INVENTREE_DEBUG: true
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -151,17 +151,17 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
target: target:
- ubuntu:22.04
- ubuntu:24.04 - ubuntu:24.04
- debian:12 - ubuntu:26.04
- debian:13
steps: steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
- name: Get frontend artifact - name: Get frontend artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # pin@v8.0.1 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: with:
name: frontend-build name: frontend-build
- name: Setup - name: Setup
@ -216,7 +216,7 @@ jobs:
pip install --require-hashes -r contrib/dev_reqs/requirements.txt pip install --require-hashes -r contrib/dev_reqs/requirements.txt
python3 .github/scripts/version_check.py python3 .github/scripts/version_check.py
- name: Package - current release channel - name: Package - current release channel
uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # pin@main uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # main
id: package id: package
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
@ -234,7 +234,7 @@ jobs:
INVENTREE_CONFIG_FILE=/opt/inventree/config.yaml INVENTREE_CONFIG_FILE=/opt/inventree/config.yaml
APP_REPO=inventree/InvenTree APP_REPO=inventree/InvenTree
- name: Publish to go.packager.io - current release channel - name: Publish to go.packager.io - current release channel
uses: pkgr/action/publish@3bce081ae512c5020856e237d37b3f5479d4aa71 # pin@main uses: pkgr/action/publish@c5666febcd31750da6428042193fc5b2fb765435 # main
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
token: ${{ secrets.PACKAGER_RELEASE_TOKEN }} token: ${{ secrets.PACKAGER_RELEASE_TOKEN }}
@ -249,7 +249,7 @@ jobs:
PACKAGE_NAME: ${{ matrix.target }}-${{ steps.setup.outputs.version }}.tar.gz PACKAGE_NAME: ${{ matrix.target }}-${{ steps.setup.outputs.version }}.tar.gz
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package - stable release channel - name: Package - stable release channel
uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # pin@main uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # main
id: package-stable id: package-stable
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
@ -267,7 +267,7 @@ jobs:
INVENTREE_CONFIG_FILE=/opt/inventree/config.yaml INVENTREE_CONFIG_FILE=/opt/inventree/config.yaml
APP_REPO=inventree/InvenTree APP_REPO=inventree/InvenTree
- name: Publish to go.packager.io - stable release channel - name: Publish to go.packager.io - stable release channel
uses: pkgr/action/publish@3bce081ae512c5020856e237d37b3f5479d4aa71 # pin@main uses: pkgr/action/publish@c5666febcd31750da6428042193fc5b2fb765435 # main
with: with:
target: ${{ matrix.target }} target: ${{ matrix.target }}
token: ${{ secrets.PACKAGER_RELEASE_TOKEN }} token: ${{ secrets.PACKAGER_RELEASE_TOKEN }}

View File

@ -32,7 +32,7 @@ jobs:
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false

View File

@ -16,7 +16,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # pin@v10.3.0 - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue seems stale. Please react to show this is still important." stale-issue-message: "This issue seems stale. Please react to show this is still important."

View File

@ -6,7 +6,7 @@ on:
- master - master
env: env:
python_version: 3.11 python_version: 3.12
node_version: 24 node_version: 24
permissions: permissions:
@ -32,7 +32,7 @@ jobs:
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # pin@v6.0.3 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Environment Setup - name: Environment Setup
@ -56,7 +56,7 @@ jobs:
echo "Resetting to HEAD~" echo "Resetting to HEAD~"
git reset HEAD~ || true git reset HEAD~ || true
- name: crowdin action - name: crowdin action
uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # pin@v2 uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2
with: with:
upload_sources: true upload_sources: true
upload_translations: false upload_translations: false

View File

@ -9,7 +9,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
persist-credentials: false persist-credentials: false
- name: Setup - name: Setup
@ -18,7 +18,7 @@ jobs:
run: pip-compile --output-file=requirements.txt requirements.in -U run: pip-compile --output-file=requirements.txt requirements.in -U
- name: Update requirements-dev.txt - name: Update requirements-dev.txt
run: pip-compile --generate-hashes --output-file=requirements-dev.txt requirements-dev.in -U run: pip-compile --generate-hashes --output-file=requirements-dev.txt requirements-dev.in -U
- uses: stefanzweifel/git-auto-commit-action@fd157da78fa13d9383e5580d1fd1184d89554b51 # pin@v4.15.1 - uses: stefanzweifel/git-auto-commit-action@fd157da78fa13d9383e5580d1fd1184d89554b51 # v4.15.1
with: with:
commit_message: "[Bot] Updated dependency" commit_message: "[Bot] Updated dependency"
branch: dep-update branch: dep-update

View File

@ -21,9 +21,9 @@ before:
dependencies: dependencies:
- curl - curl
- poppler-utils - poppler-utils
- "python3.11 | python3.12 | python3.13 | python3.14" - "python3.12 | python3.13 | python3.14"
- "python3.11-venv | python3.12-venv | python3.13-venv | python3.14-venv" - "python3.12-venv | python3.13-venv | python3.14-venv"
- "python3.11-dev | python3.12-dev | python3.13-dev | python3.14-dev" - "python3.12-dev | python3.13-dev | python3.14-dev"
- python3-pip - python3-pip
- python3-cffi - python3-cffi
- python3-brotli - python3-brotli
@ -36,6 +36,6 @@ dependencies:
- jq - jq
- "libffi7 | libffi8" - "libffi7 | libffi8"
targets: targets:
ubuntu-22.04: true
ubuntu-24.04: true ubuntu-24.04: true
debian-12: true ubuntu-26.04: true
debian-13: true

View File

@ -97,4 +97,4 @@ repos:
rev: 0.4.3 rev: 0.4.3
hooks: hooks:
- id: teyit - id: teyit
language_version: python3.11 language_version: python3.12

2
.vscode/launch.json vendored
View File

@ -47,7 +47,7 @@
"name": "InvenTree invoke schema", "name": "InvenTree invoke schema",
"type": "debugpy", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/.venv/lib/python3.11/site-packages/invoke/__main__.py", "program": "${workspaceFolder}/.venv/lib/python3.12/site-packages/invoke/__main__.py",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"args": [ "args": [
"dev.schema","--ignore-warnings" "dev.schema","--ignore-warnings"

View File

@ -5,6 +5,25 @@ All major notable changes to this project will be documented in this file (start
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased - xxxx.xx.xx
### Breaking Changes
- [#12320](https://github.com/inventree/InvenTree/pull/12320) changes the default behavior of the `invoke migrate` command. Now, it no longer generates new migrations by default. Instead, it will only apply existing migrations to the database. If you want to detect and generate new migrations, you must now explicitly use the `--detect` flag. This change was made to prevent accidental generation of migrations when running the command, which could lead to unexpected changes in the database schema. Additionally, `invoke update` will no longer result in new migrations being generated, and will only apply existing migrations to the database. This change was made to ensure that the update process is predictable and does not introduce unexpected changes to the database schema.
- [#12223](https://github.com/inventree/InvenTree/pull/12223) removes support for python 3.11 and stops providing packages for Debian 11 and Ubuntu 20.04.
### Added
- [#12341](https://github.com/inventree/InvenTree/pull/12341) adds support for importing internal part prices.
- [#12295](https://github.com/inventree/InvenTree/pull/12295) adds "consumable" field to the Part model and API endpoints
- [#12250](https://github.com/inventree/InvenTree/pull/12250) adds "active" field to the ProjectCode model and API endpoints
### Changed
- [#12274](https://github.com/inventree/InvenTree/pull/12274) fixes a bug in rendering the "table field" component in frontend forms. Any plugins which make use of the "table field" component in their forms may be affected by this change, and will need to update their form definitions accordingly.
### Removed
## 1.4.0 - 2026-06-24 ## 1.4.0 - 2026-06-24
### Breaking Changes ### Breaking Changes

View File

@ -23,7 +23,6 @@ The InvenTree project is split into two main components: frontend and backend. T
``` ```
InvenTree/ InvenTree/
├─ .devops/ # Files for Azure DevOps
├─ .github/ # Files for GitHub ├─ .github/ # Files for GitHub
│ ├─ actions/ # Reused actions │ ├─ actions/ # Reused actions
│ ├─ ISSUE_TEMPLATE/ # Templates for issues and pull requests │ ├─ ISSUE_TEMPLATE/ # Templates for issues and pull requests
@ -105,8 +104,8 @@ The project uses [Invoke](https://www.pyinvoketasks.com/) (`tasks.py`) as the ta
# One-time setup: creates venv at dev/venv/, installs deps, sets up pre-commit hooks # One-time setup: creates venv at dev/venv/, installs deps, sets up pre-commit hooks
invoke dev.setup-dev invoke dev.setup-dev
# Apply database migrations # Apply database migrations (and detect/create new migration files if required)
invoke migrate invoke migrate --detect
# Create an admin account (required to log in) # Create an admin account (required to log in)
invoke superuser invoke superuser

View File

@ -9,7 +9,6 @@
[![Documentation Status](https://readthedocs.org/projects/inventree/badge/?version=latest)](https://inventree.readthedocs.io/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/inventree/badge/?version=latest)](https://inventree.readthedocs.io/en/latest/?badge=latest)
![Docker Build](https://github.com/inventree/inventree/actions/workflows/docker.yaml/badge.svg) ![Docker Build](https://github.com/inventree/inventree/actions/workflows/docker.yaml/badge.svg)
[![Netlify Status](https://api.netlify.com/api/v1/badges/9bbb2101-0a4d-41e7-ad56-b63fb6053094/deploy-status)](https://app.netlify.com/sites/inventree/deploys) [![Netlify Status](https://api.netlify.com/api/v1/badges/9bbb2101-0a4d-41e7-ad56-b63fb6053094/deploy-status)](https://app.netlify.com/sites/inventree/deploys)
[![Performance Testing](https://dev.azure.com/InvenTree/InvenTree%20test%20statistics/_apis/build/status%2Fmatmair.InvenTree?branchName=testing)](https://dev.azure.com/InvenTree/InvenTree%20test%20statistics/_build/latest?definitionId=3&branchName=testing)
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7179/badge)](https://bestpractices.coreinfrastructure.org/projects/7179) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/7179/badge)](https://bestpractices.coreinfrastructure.org/projects/7179)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/inventree/InvenTree/badge)](https://securityscorecards.dev/viewer/?uri=github.com/inventree/InvenTree) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/inventree/InvenTree/badge)](https://securityscorecards.dev/viewer/?uri=github.com/inventree/InvenTree)
@ -202,6 +201,7 @@ Find a full list of used third-party libraries in the license information dialog
<a href="https://www.netlify.com"> <img src="https://www.netlify.com/v3/img/components/netlify-color-bg.svg" alt="Deploys by Netlify" /> </a> <a href="https://www.netlify.com"> <img src="https://www.netlify.com/v3/img/components/netlify-color-bg.svg" alt="Deploys by Netlify" /> </a>
<a href="https://crowdin.com"> <img src="https://crowdin.com/images/crowdin-logo.svg" alt="Translation by Crowdin" /> </a> <br> <a href="https://crowdin.com"> <img src="https://crowdin.com/images/crowdin-logo.svg" alt="Translation by Crowdin" /> </a> <br>
<a href="https://codspeed.io/inventree/InvenTree?utm_source=badge"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed Badge"/></a> <a href="https://codspeed.io/inventree/InvenTree?utm_source=badge"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed Badge"/></a>
<a href="https://flakiness.io/InvenTree/InvenTree"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fflakiness.io%2Fapi%2Fbadge%3Finput%3D%257B%2522badgeToken%2522%253A%2522badge-35mqq5Ht4uL3vGF8lR9P2D%2522%257D" alt="Flakiness Badge"/></a>
</p> </p>

View File

@ -24,7 +24,7 @@ flag_management:
carryforward: true carryforward: true
statuses: statuses:
- type: project - type: project
target: 40% target: 38%
- name: web - name: web
carryforward: true carryforward: true
statuses: statuses:

View File

@ -10,7 +10,7 @@
# - Monitors source files for any changes, and live-reloads server # - Monitors source files for any changes, and live-reloads server
# Base image last bumped 2026-06-16 # Base image last bumped 2026-06-16
FROM python:3.14.6-slim-trixie@sha256:44dd04494ee8f3b538294360e7c4b3acb87c8268e4d0a4828a6500b1eff50061 AS inventree_base FROM python:3.14.6-slim-trixie@sha256:b877e50bd90de10af8d82c57a022fc2e0dc731c5320d762a27986facfc3355c1 AS inventree_base
# Build arguments for this image # Build arguments for this image
ARG commit_tag="" ARG commit_tag=""
@ -119,7 +119,8 @@ RUN pip install --user --require-hashes -r base_requirements.txt --no-cache-dir
rm -rf /root/.cache/pip rm -rf /root/.cache/pip
# Install frontend build dependencies # Install frontend build dependencies
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.5/install.sh | bash && \ # pinned to v0.40.5
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/1889911f0841e669de0be5bd02c737a3f1fd20fa/install.sh | bash && \
bash -c "export NVM_DIR="$HOME/.nvm" && source $HOME/.nvm/nvm.sh && \ bash -c "export NVM_DIR="$HOME/.nvm" && source $HOME/.nvm/nvm.sh && \
nvm install $NODE_VERSION && corepack enable yarn && yarn config set network-timeout 600000 -g" nvm install $NODE_VERSION && corepack enable yarn && yarn config set network-timeout 600000 -g"
RUN bash -c "source $HOME/.nvm/nvm.sh && cd '${INVENTREE_HOME}' && invoke int.frontend-compile --extract" RUN bash -c "source $HOME/.nvm/nvm.sh && cd '${INVENTREE_HOME}' && invoke int.frontend-compile --extract"

View File

@ -1,18 +1,18 @@
# Base python requirements for docker containers # Base python requirements for docker containers
# Basic package requirements # Basic package requirements
invoke>=2.2.0 # Invoke build tool invoke # Invoke build tool
pyyaml>=6.0.1 pyyaml
setuptools>=69.0.0 setuptools
wheel>=0.41.0 wheel
# Database links # Database links
psycopg[binary, pool] psycopg[binary, pool]
mysqlclient>=2.2.0 mysqlclient
mariadb>=1.1.8 mariadb
# gunicorn web server # gunicorn web server
gunicorn>=22.0.0 gunicorn
# LDAP required packages # LDAP required packages
django-auth-ldap # Django integration for ldap auth django-auth-ldap # Django integration for ldap auth

View File

@ -236,26 +236,26 @@ typing-extensions==4.15.0 \
# via # via
# -c src/backend/requirements.txt # -c src/backend/requirements.txt
# psycopg-pool # psycopg-pool
uv==0.11.23 \ uv==0.11.24 \
--hash=sha256:03fbb0a1c7b6d15e96778bdd79e8d1826c6259fea17fc13337fb0744136953f2 \ --hash=sha256:047d763d20d71968c00f4afec40b0e75d9da7e3693f725b9f502d84a25256893 \
--hash=sha256:3a900c8fd757f8c3da9dc5532d9a22d30540e91fdefd63c93909fedbfd756655 \ --hash=sha256:0e100b9cbc59beff2730840ac989b1f100cc03c90514e7cab6992a1f3f13784e \
--hash=sha256:576d776a1ca62e3d8aba99f0d8ec607db91a5ebaf52feaff820f28ed820e1665 \ --hash=sha256:3176668ea8a2318d775c0d9188661c61ccc36790220724b1d360fcc8945d520e \
--hash=sha256:61e6bd7e7f0fe24f103540ba19516443bea6e689022c787217310a1e64558e3f \ --hash=sha256:356435577fae11fafe7a067ee3269cccefd35b031b83a3a36c87fe9d192bffba \
--hash=sha256:6d7cea7d9ade3c1c3e3db1dfcc23d335bceaabf38f51e442b6f57f8f7885a9a6 \ --hash=sha256:38f38c9449aafd71dc0fa35e66a8a547ee48947b2f2f94084893c2afe6058cfa \
--hash=sha256:7a85330de0a7eb0d5c6cf03c80edfb86facad19df367a0b52fc906db1ab15ce9 \ --hash=sha256:438f8291fb9daea30a4bd333299b82e6ef755578302745a021162f328cfcfc68 \
--hash=sha256:91d19c4249d7437b69b91c385134360d7ed9d0ee2e2e83e81d369867151e78c2 \ --hash=sha256:48a6123f71b801e0e0b8a38520b011632ad81e0a043445044ce5b1a7b1cec7b6 \
--hash=sha256:985aa93c9d6223e32fc747e09662537c4073c9ebef59c0a4fd7c6949d1d24fb3 \ --hash=sha256:6ecdad43e870f88d3772d9d37e877259ae35ec374d51589805cdcf6196205829 \
--hash=sha256:9dd412127cbe0e115bd3fc5c6cbe9cf59f593273fafab9f7dc6b2ac95efcc7c1 \ --hash=sha256:79757f90b7765996366b80e77cad13555c7f7e1282ca8d8b686ee21773ab0b77 \
--hash=sha256:ac337dacd640aab1ef97cf00f8c01e2889f0fd0ef8460a0f4e816bf12bb5988b \ --hash=sha256:8346b0086d213b80430f3bb4477379a8a4fa550b03447d23c84eee85c2e52bc4 \
--hash=sha256:b3f515fd6b43068f241467496bced62cb2ed36d52d4c0877cfe61a1240713d32 \ --hash=sha256:8602a1b6300a3a948afacc62e1cb933c8394c27966db85ed7e29483300b69dc4 \
--hash=sha256:b8abe7d6f5e0d92bd41a9c000bbd9c8387af7886df4790c0451a34e781b8a075 \ --hash=sha256:9312b6fd44361674e9c847a828ded792493766697816261e05848a024fe34129 \
--hash=sha256:bbc41182d655f92cd380ecdf378da7fc1598c6b19057208f450f0ee9c259f46a \ --hash=sha256:bf568c62dddd55ad9c85a16ffdfbcc7746be9c3159ed644e4f9e6f5e44905cbb \
--hash=sha256:c2089b992919858dabae89d410cbb5cecf9034d26bbb04f14e6da52dffced290 \ --hash=sha256:c4ab221c0a949f8006a7582786dae384706b2f82016a0db60baa7cc696042705 \
--hash=sha256:ca1d37e851fb9323250385403d8512a71c0d1b6162c729ff4909f37cfd067920 \ --hash=sha256:c8ec3caf656645f58b53cb9aee9aa95cfc65c82ba2d7f1362bfd2660d1484307 \
--hash=sha256:d256f90513d01ff6cbc2f17d88c0ccde65d138500df547ece214e6a50731c4b7 \ --hash=sha256:d6a49543c659c0cf1ff4c944955d97e69dbce4b76e3d284f5a92cea19133ebb6 \
--hash=sha256:d62410e5f60a961cfda00ead8a1cc5fd37d052afda021099e488e90c15419beb \ --hash=sha256:e499579f557abf17b8ffd1490d3e827748aea096f6eaa66737e729e046449f08 \
--hash=sha256:e7e215d69ea21fd5824a63edf8fef933bee2c028a0c2930651cfa6b88ca4ff8e \ --hash=sha256:e7e78c18686202c8b8715bebb83bfaf58f82d7fb848b6a5ae4e925a9fac3de4c \
--hash=sha256:f2476dda35866ea3ded3a5905759da2d32dfac36dfd5b3428191a99a8ce15b02 --hash=sha256:ed0c9a9d7909f0e48a9dafe666ca9ebefe2a1534e51ed05c0a7de7406465f868
# via -r contrib/container/requirements.in # via -r contrib/container/requirements.in
wheel==0.47.0 \ wheel==0.47.0 \
--hash=sha256:212281cab4dff978f6cedd499cd893e1f620791ca6ff7107cf270781e587eced \ --hash=sha256:212281cab4dff978f6cedd499cd893e1f620791ca6ff7107cf270781e587eced \

View File

@ -1,4 +1,4 @@
# Packages needed for CI/packages # Packages needed for CI/packages
requests==2.34.2 requests==2.34.2
pyyaml==6.0.3 pyyaml==6.0.3
jc==1.25.6 jc

View File

@ -145,9 +145,9 @@ idna==3.18 \
# via # via
# -c src/backend/requirements.txt # -c src/backend/requirements.txt
# requests # requests
jc==1.25.6 \ jc==1.25.7 \
--hash=sha256:27f58befc7ae0a4c63322926c5f1ec892e3eac4a065eff3b07cfe420a6924a07 \ --hash=sha256:5ed6a0da915c931c04693cab806d5c31d9ef14ca998c6c32308460d37cb30baf \
--hash=sha256:7367b59e6e0da8babeede1e5b0da083f3c5aa6b6e585b4aed28dd7c4b2d76162 --hash=sha256:63481e34d92715781e1b094eca7d76d122a14489463d45b7f3e8180f44ea3a10
# via -r contrib/dev_reqs/requirements.in # via -r contrib/dev_reqs/requirements.in
pygments==2.20.0 \ pygments==2.20.0 \
--hash=sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f \ --hash=sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f \

View File

@ -79,7 +79,7 @@ function detect_python() {
echo "${On_Red}" echo "${On_Red}"
echo "# POI07| Python ${SETUP_PYTHON} not found - aborting!" echo "# POI07| Python ${SETUP_PYTHON} not found - aborting!"
echo "# POI07| Please ensure python can be executed with the command '$SETUP_PYTHON' by the current user '$USER'." echo "# POI07| Please ensure python can be executed with the command '$SETUP_PYTHON' by the current user '$USER'."
echo "# POI07| If you are using a different python version, please set the environment variable SETUP_PYTHON to the correct command - eg. 'python3.11'." echo "# POI07| If you are using a different python version, please set the environment variable SETUP_PYTHON to the correct command - eg. 'python3.12'."
echo "${Color_Off}" echo "${Color_Off}"
exit 1 exit 1
fi fi

View File

@ -26,7 +26,7 @@ export DATA_DIR=${APP_HOME}/data
export SETUP_NGINX_FILE=${SETUP_NGINX_FILE:-/etc/nginx/sites-enabled/inventree.conf} export SETUP_NGINX_FILE=${SETUP_NGINX_FILE:-/etc/nginx/sites-enabled/inventree.conf}
export SETUP_ADMIN_PASSWORD_FILE=${CONF_DIR}/admin_password.txt export SETUP_ADMIN_PASSWORD_FILE=${CONF_DIR}/admin_password.txt
export SETUP_NO_CALLS=${SETUP_NO_CALLS:-false} export SETUP_NO_CALLS=${SETUP_NO_CALLS:-false}
export SETUP_PYTHON=${SETUP_PYTHON:-python3.11} export SETUP_PYTHON=${SETUP_PYTHON:-python3.12}
export SETUP_ADMIN_NOCREATION=${SETUP_ADMIN_NOCREATION:-false} export SETUP_ADMIN_NOCREATION=${SETUP_ADMIN_NOCREATION:-false}
# SETUP_DEBUG can be set to get debug info # SETUP_DEBUG can be set to get debug info
# SETUP_EXTRA_PIP can be set to install extra pip packages # SETUP_EXTRA_PIP can be set to install extra pip packages

View File

@ -48,7 +48,7 @@ Users can authenticate against the API using basic authentication - specifically
Each user is assigned an authentication token which can be used to access the API. This token is persistent for that user (unless invalidated by an administrator) and can be used across multiple sessions. Each user is assigned an authentication token which can be used to access the API. This token is persistent for that user (unless invalidated by an administrator) and can be used across multiple sessions.
!!! info "Token Administration" !!! info "Token Administration"
User tokens can be created and/or invalidated via the user settings, [Admin Center](../settings/admin.md#admin-center) or admin interface. User tokens can be created and/or invalidated via the user settings, [Admin Center](../settings/admin.md#admin-center), or the [Database Admin interface](../settings/db_admin.md).
#### Requesting a Token #### Requesting a Token

View File

@ -101,7 +101,7 @@ If enabled, InvenTree can retain logs of the most recent barcode scans. This can
Refer to the [barcode settings](../settings/global.md#barcodes) to enable barcode history logging. Refer to the [barcode settings](../settings/global.md#barcodes) to enable barcode history logging.
The barcode history can be viewed via the admin panel in the web interface. The barcode history can be viewed in the [Admin Center](../settings/admin.md#admin-center) in the web interface.
## Barcode Settings ## Barcode Settings

View File

@ -4,7 +4,7 @@ title: Importing Data
## Importing Data ## Importing Data
External data can be imported via the admin interface, allowing for rapid integration of existing datasets, or bulk editing of table data. External data can be imported via the [Admin Center](../settings/admin.md#admin-center), allowing for rapid integration of existing datasets, or bulk editing of table data.
!!! danger "Danger" !!! danger "Danger"
Uploading bulk data directly is a non-reversible action. Uploading bulk data directly is a non-reversible action.

View File

@ -35,7 +35,7 @@ Parameter templates are used to define the different types of parameters which a
### Create Template ### Create Template
Parameter templates are created and edited via the [admin interface](../settings/admin.md). Parameter templates are created and edited via the [Admin Center](../settings/admin.md#admin-center).
To create a template: To create a template:

View File

@ -60,7 +60,8 @@ The user menu provides access to the following items:
- **User Settings:** Access to [user settings](../settings/user.md). - **User Settings:** Access to [user settings](../settings/user.md).
- **System Settings:** Access to [global settings](../settings/global.md) settings. *Note: Access to system settings may be restricted based on user permissions.* - **System Settings:** Access to [global settings](../settings/global.md) settings. *Note: Access to system settings may be restricted based on user permissions.*
- **Admin Interface:** Access to the [admin interface](../settings/admin.md) for data management. *Note: Access to the admin interface may be restricted based on user permissions.* - **Admin Center:** Access to the [Admin Center](../settings/admin.md#admin-center) for operational administration.
- **Database Admin Interface:** Low-level administration via the [Database Admin interface](../settings/db_admin.md). *Note: Access may be restricted based on user permissions and staff status.*
- **Change Color Mode:** Toggle between light and dark color modes. - **Change Color Mode:** Toggle between light and dark color modes.
- **About InvenTree:** View version and license information about InvenTree. - **About InvenTree:** View version and license information about InvenTree.
- **Logout:** Log out of the InvenTree system. - **Logout:** Log out of the InvenTree system.
@ -283,6 +284,14 @@ Example: Editing an existing purchase order via the "Edit Purchase Order" form:
{{ image("concepts/ui_form_edit_po.png", "Edit Purchase Order") }} {{ image("concepts/ui_form_edit_po.png", "Edit Purchase Order") }}
### Form Submission
A form can be submitted by clicking the "Submit" button located at the bottom-right corner of the form.
Alternatively, an open form can be submitted using the keyboard shortcut `Ctrl + Enter` (or `Cmd + Enter` on macOS). This shortcut works even while typing in a form field, providing a quick way to submit the form without needing to reach for the mouse. It is particularly useful in multi-line text fields, where pressing `Enter` inserts a new line rather than submitting the form.
The keyboard shortcut is only active while a form is open, and follows the same rules as the "Submit" button - for example, it has no effect while the form is loading, or when editing an existing item without any changes.
### Confirm Actions ### Confirm Actions
Many actions within InvenTree require user confirmation before they can be executed. This is typically implemented through the use of confirmation dialogs, which prompt the user to confirm their intention before proceeding with the action. Many actions within InvenTree require user confirmation before they can be executed. This is typically implemented through the use of confirmation dialogs, which prompt the user to confirm their intention before proceeding with the action.

View File

@ -184,7 +184,7 @@ django-upgrade --target-version {{ config.extra.django_version }} `find . -name
## Migration Files ## Migration Files
Any required migration files **must** be included in the commit, or the pull-request will be rejected. If you change the underlying database schema, make sure you run `invoke migrate` and commit the migration files before submitting the PR. Any required migration files **must** be included in the commit, or the pull-request will be rejected. If you change the underlying database schema, make sure you run `invoke migrate --detect` and commit the migration files before submitting the PR.
*Note: A github action checks for unstaged migration files and will reject the PR if it finds any!* *Note: A github action checks for unstaged migration files and will reject the PR if it finds any!*

View File

@ -4,10 +4,10 @@ import json
import os import os
import re import re
from datetime import datetime from datetime import datetime
from distutils.version import StrictVersion # type: ignore[import]
from pathlib import Path from pathlib import Path
import requests import requests
from packaging.version import Version
here = Path(__file__).parent here = Path(__file__).parent
@ -57,7 +57,7 @@ def fetch_rtd_versions():
print('No RTD token found - skipping RTD version fetch') print('No RTD token found - skipping RTD version fetch')
# Sort versions by version number # Sort versions by version number
versions = sorted(versions, key=lambda x: StrictVersion(x['version']), reverse=True) versions = sorted(versions, key=lambda x: Version(x['version']), reverse=True)
# Add "latest" version first # Add "latest" version first
if not any(x['title'] == 'latest' for x in versions): if not any(x['title'] == 'latest' for x in versions):

View File

@ -50,6 +50,8 @@ In the example below, see that the *Wood Screw* line item is marked as consumabl
Further, in the [Build Order](./build.md) stock allocation table, we see that this line item cannot be allocated, as it is *consumable*. Further, in the [Build Order](./build.md) stock allocation table, we see that this line item cannot be allocated, as it is *consumable*.
Marking a BOM line item as consumable is a per-assembly override - it only affects how the part is treated within *this* particular BOM, and does not change the underlying part definition. A part can also be marked as consumable directly - refer to the [consumable parts documentation](../part/consumable.md) for more information on the distinction between the two, and reasons why a part may be marked as consumable.
### Optional BOM Line Items ### Optional BOM Line Items
If a BOM line item is marked as *optional*, this means that the part and quantity information is tracked in the BOM, but this line item is not required to be allocated to a [Build Order](./build.md). This may be useful for certain items which are not strictly required for the build process to be completed. If a BOM line item is marked as *optional*, this means that the part and quantity information is tracked in the BOM, but this line item is not required to be allocated to a [Build Order](./build.md). This may be useful for certain items which are not strictly required for the build process to be completed.

View File

@ -0,0 +1,55 @@
---
title: Consumable Parts
---
## Consumable Parts
A *Consumable* part is one which is generally used up, or expended, during a build or other process, rather than being tracked and allocated as a discrete item.
Consumable parts can be used to represent things such as:
- Glue or adhesive
- Solder
- Cleaning fluid
- Fasteners or other low-value hardware
- Other general workshop supplies
Marking a part as consumable is intended to help distinguish these types of supplies from other parts in the inventory, making it easier to filter and report on "real" stock items versus general consumables.
### Why Mark a Part as Consumable?
Not every item required to complete a build needs to be tracked and allocated with the same rigor as a high-value component. A part might be marked as consumable because it is:
- Low value, making the overhead of precise allocation not worth the effort
- Kept in abundant stock, such that running out is unlikely to be a concern
- Difficult to track in discrete units, such as a fluid or adhesive
- Not something the business needs (or wants) visibility into at the build order level
Marking a part as consumable communicates this intent clearly wherever the part is used, without needing to remember to configure each individual BOM line item.
### Stock Items
Consumable parts can have stock items associated with them, the same as any other part. Stock levels for consumable parts can be tracked and managed as normal.
### Bills of Material
Consumable parts can be added as a subcomponent to the [Bills of Material](../manufacturing/bom.md) for an assembled part, in the same way as any other component.
### Build Orders
Unlike a regular component, a consumable part is not allocated to (or consumed by) a [Build Order](../manufacturing/build.md). When a build order is completed, stock quantities for consumable parts are not adjusted.
If stock levels for a consumable part need to be updated to reflect usage during a build, this must be done manually.
### Consumable BOM Line Items
Separately from the *Consumable* flag on the part itself, an individual [BOM line item](../manufacturing/bom.md#consumable-bom-line-items) can also be marked as *consumable*.
This allows a part which is **not** normally marked as consumable to be treated as consumable *for the purposes of a specific BOM*. For example, a fastener which is usually tracked precisely in one assembly might be treated as consumable in another assembly, without needing to change the underlying part definition.
In other words:
- The part-level *Consumable* flag is a permanent property of the part, and applies everywhere that part is used.
- The BOM line item *Consumable* flag is a per-assembly override, and only affects how that part is treated within that particular BOM.
If a part is already marked as consumable, marking the corresponding BOM line item as consumable as well has no additional effect.

View File

@ -85,4 +85,4 @@ In addition to the primary methods for creating or importing part data, the foll
- [Via the REST API](../api/index.md) - [Via the REST API](../api/index.md)
- [Using the Python library](../api/python/index.md) - [Using the Python library](../api/python/index.md)
- [Within the Admin interface](../settings/admin.md) - [Within the Database Admin interface](../settings/db_admin.md)

View File

@ -87,6 +87,9 @@ A [Purchase Order](../purchasing/purchase_order.md) allows parts to be ordered f
If a part is designated as *Salable* it can be sold to external customers. Setting this flag allows parts to be added to sales orders. If a part is designated as *Salable* it can be sold to external customers. Setting this flag allows parts to be added to sales orders.
### Consumable
A *Consumable* part is one which is generally used up during a build or other process, rather than being tracked and allocated as a discrete item. Refer to the [consumable parts documentation](./consumable.md) for more information.
## Locked Parts ## Locked Parts

View File

@ -113,10 +113,10 @@ Refer to the [sample plugins]({{ sourcedir("src/backend/InvenTree/plugin/samples
A *PluginConfig* database entry will be created for each plugin "discovered" when the server launches. This configuration entry is used to determine if a particular plugin is enabled. A *PluginConfig* database entry will be created for each plugin "discovered" when the server launches. This configuration entry is used to determine if a particular plugin is enabled.
The configuration entries must be enabled via the [InvenTree admin interface](../settings/admin.md). The configuration entries must be enabled via the [Admin Center](../settings/admin.md#admin-center).
!!! warning "Disabled by Default" !!! warning "Disabled by Default"
Newly discovered plugins are disabled by default, and must be manually enabled (in the admin interface) by a user with staff privileges. Newly discovered plugins are disabled by default, and must be manually enabled (in the Admin Center) by a user with staff privileges.
## Plugin Mixins ## Plugin Mixins

View File

@ -4,15 +4,57 @@ title: Report Mixin
## ReportMixin ## ReportMixin
The `ReportMixin` class provides a plugin with the ability to extend the functionality of custom [report templates](../../report/report.md). A plugin which implements the ReportMixin mixin class can add custom context data to a report template for rendering. The `ReportMixin` class provides a plugin with the ability to extend the functionality of custom [report templates](../../report/report.md). A plugin which implements the ReportMixin mixin class can add custom context data to a report template for rendering, and can also receive a callback when a report is generated.
### Add Report Context ### Add Report Context
A plugin which implements the ReportMixin mixin can define the `add_report_context` method, allowing custom context data to be added to a report template at time of printing. A plugin which implements the ReportMixin mixin can define the `add_report_context` method, allowing custom context data to be added to a report template at time of printing.
This method is called each time a report is generated, and is passed the following arguments:
| Argument | Description |
| --- | --- |
| `report_instance` | The report template instance which is being rendered |
| `model_instance` | The model instance against which the report is being generated |
| `user` | The user who initiated the report generation |
| `context` | The context dictionary, which can be modified in-place |
Any data added to the provided `context` dictionary is made available to the report template, and can be rendered using standard django template syntax:
```python
def add_report_context(self, report_instance, model_instance, user, context):
"""Add extra context data to the report template."""
context['my_custom_data'] = self.calculate_custom_data(model_instance)
```
### Add Label Context ### Add Label Context
Additionally the `add_label_context` method, allowing custom context data to be added to a label template at time of printing. Similarly, the `add_label_context` method allows custom context data to be added to a label template at time of printing:
| Argument | Description |
| --- | --- |
| `label_instance` | The label template instance which is being rendered |
| `model_instance` | The model instance against which the label is being generated |
| `user` | The user who initiated the label generation |
| `context` | The context dictionary, which can be modified in-place |
### Report Callback
The `report_callback` method is called after a report has been generated, and allows the plugin to perform custom actions with the generated report - for example, forwarding the report to an external system, or performing custom post-processing.
| Argument | Description |
| --- | --- |
| `template` | The report template instance which was used to generate the report |
| `instance` | The model instance against which the report was generated |
| `report` | The generated report (PDF file data) |
| `user` | The user who initiated the report generation |
```python
def report_callback(self, template, instance, report, user, **kwargs):
"""Custom callback function - called after a report is generated."""
# For example, forward the generated report to an external service
self.upload_to_external_service(report)
```
### Sample Plugin ### Sample Plugin

View File

@ -74,7 +74,7 @@ npm install
npm run build npm run build
``` ```
Copy the built `attachment_carousel` directory to the `inventree-data/plugins` directory and enable it via the admin interface. Copy the built `attachment_carousel` directory to the `inventree-data/plugins` directory and enable it via the [Admin Center](../settings/admin.md#admin-center).
![Attachment Carousel in Inventree panel screenshot](../assets/images/plugin/plugin_walkthrough_default.png "Attachment Carousel in Inventree panel screenshot") ![Attachment Carousel in Inventree panel screenshot](../assets/images/plugin/plugin_walkthrough_default.png "Attachment Carousel in Inventree panel screenshot")

View File

@ -14,6 +14,8 @@ Individuals and companies can also support via [GitHub sponsors](https://github.
- [Codecov](https://codecov.io) - Code coverage as a service, used to track the code coverage of the various components - [Codecov](https://codecov.io) - Code coverage as a service, used to track the code coverage of the various components
- [Netlify](https://www.netlify.com/) - Static site hosting provider, used to test deploy the frontend and website - [Netlify](https://www.netlify.com/) - Static site hosting provider, used to test deploy the frontend and website
- [Depot](https://depot.dev/?utm_source=inventree) - Docker build accelerator, used to build the multi-arch images for the InvenTree docker image - [Depot](https://depot.dev/?utm_source=inventree) - Docker build accelerator, used to build the multi-arch images for the InvenTree docker image
- [CodSpeed](https://codspeed.io/) - Performance testing platform, used to track the performance of a few performance benchmarks
- [Flakiness](https://flakiness.io/) - Frontend test flakiness detection, used to track the flakiness of the various test harnesses
## Past Supporters ## Past Supporters

View File

@ -0,0 +1,45 @@
---
title: Report Assets
---
## Report Assets
Users can upload asset files (e.g. images) which can be used when generating reports. For example, you may wish to generate a report with your company logo in the header.
Asset files are managed from the [Admin Center](../settings/admin.md#admin-center), via the *Report Assets* panel. Staff users can upload new asset files, and remove assets which are no longer required.
Asset files can be rendered directly into the template as follows
```html
{% raw %}
<!-- Need to include the report template tags at the start of the template file -->
{% load report %}
<!-- Simple stylesheet -->
<head>
<style>
.company-logo {
height: 50px;
}
</style>
</head>
<body>
<!-- Report template code here -->
<!-- Render an uploaded asset image -->
<img src="{% asset 'company_image.png' %}" class="company-logo">
<!-- ... -->
</body>
{% endraw %}
```
!!! warning "Asset Naming"
If the requested asset name does not match the name of an uploaded asset, the template will continue without loading the image.
!!! info "Assets location"
Upload new assets via the *Report Assets* panel in the [Admin Center](../settings/admin.md#admin-center) to ensure they are uploaded to the correct location on the server.
There are various [helper functions](./helpers.md#report-assets) available to assist with embedding assets into templates.

View File

@ -69,12 +69,14 @@ Templates (whether for generating [reports](./report.md) or [labels](./labels.md
| Model Type | Description | | Model Type | Description |
| --- | --- | | --- | --- |
| company | A Company instance | | [company](#company) | A Company instance |
| [build](#build-order) | A [Build Order](../manufacturing/build.md) instance | | [build](#build-order) | A [Build Order](../manufacturing/build.md) instance |
| [buildline](#build-line) | A [Build Order Line Item](../manufacturing/build.md) instance | | [buildline](#build-line) | A [Build Order Line Item](../manufacturing/build.md) instance |
| [salesorder](#sales-order) | A [Sales Order](../sales/sales_order.md) instance | | [salesorder](#sales-order) | A [Sales Order](../sales/sales_order.md) instance |
| [salesordershipment](#sales-order-shipment) | A [Sales Order Shipment](../sales/sales_order.md#sales-order-shipments) instance |
| [returnorder](#return-order) | A [Return Order](../sales/return_order.md) instance | | [returnorder](#return-order) | A [Return Order](../sales/return_order.md) instance |
| [purchaseorder](#purchase-order) | A [Purchase Order](../purchasing/purchase_order.md) instance | | [purchaseorder](#purchase-order) | A [Purchase Order](../purchasing/purchase_order.md) instance |
| [transferorder](#transfer-order) | A [Transfer Order](../stock/transfer_order.md) instance |
| [stockitem](#stock-item) | A [StockItem](../stock/index.md#stock-item) instance | | [stockitem](#stock-item) | A [StockItem](../stock/index.md#stock-item) instance |
| [stocklocation](#stock-location) | A [StockLocation](../stock/index.md#stock-location) instance | | [stocklocation](#stock-location) | A [StockLocation](../stock/index.md#stock-location) instance |
| [part](#part) | A [Part](../part/index.md) instance | | [part](#part) | A [Part](../part/index.md) instance |
@ -141,6 +143,16 @@ When printing a report or label against a [PurchaseOrder](../purchasing/purchase
{{ report_context("models", "purchaseorder") }} {{ report_context("models", "purchaseorder") }}
### Transfer Order
When printing a report or label against a [TransferOrder](../stock/transfer_order.md) object, the following context variables are available:
{{ report_context("models", "transferorder") }}
::: order.models.TransferOrder.report_context
options:
show_source: True
### Stock Item ### Stock Item
When printing a report or label against a [StockItem](../stock/index.md#stock-item) object, the following context variables are available: When printing a report or label against a [StockItem](../stock/index.md#stock-item) object, the following context variables are available:
@ -173,7 +185,7 @@ When printing a report or label against a [Part](../part/index.md) object, the f
## Model Variables ## Model Variables
Additional to the context variables provided directly to each template, each model type has a number of attributes and methods which can be accessedd via the template. Additional to the context variables provided directly to each template, each model type has a number of attributes and methods which can be accessed via the template.
For each model type, a subset of the most commonly used attributes are listed below. For a full list of attributes and methods, refer to the source code for the particular model type. For each model type, a subset of the most commonly used attributes are listed below. For a full list of attributes and methods, refer to the source code for the particular model type.
@ -187,7 +199,6 @@ Each part object has access to a lot of context variables about the part. The fo
|----------|-------------| |----------|-------------|
| name | Brief name for this part | | name | Brief name for this part |
| full_name | Full name for this part (including IPN, if not null and including variant, if not null) | | full_name | Full name for this part (including IPN, if not null and including variant, if not null) |
| variant | Optional variant number for this part - Must be unique for the part name
| category | The [PartCategory](#part-category) object to which this part belongs | category | The [PartCategory](#part-category) object to which this part belongs
| description | Longer form description of the part | description | Longer form description of the part
| keywords | Optional keywords for improving part search results | keywords | Optional keywords for improving part search results
@ -244,7 +255,6 @@ Each part object has access to a lot of context variables about the part. The fo
| Variable | Description | | Variable | Description |
|----------|-------------| |----------|-------------|
| parent | Link to another [StockItem](#stock-item) from which this StockItem was created | | parent | Link to another [StockItem](#stock-item) from which this StockItem was created |
| uid | Field containing a unique-id which is mapped to a third-party identifier (e.g. a barcode) |
| part | Link to the master abstract [Part](#part) that this [StockItem](#stock-item) is an instance of | | part | Link to the master abstract [Part](#part) that this [StockItem](#stock-item) is an instance of |
| supplier_part | Link to a specific [SupplierPart](#supplierpart) (optional) | | supplier_part | Link to a specific [SupplierPart](#supplierpart) (optional) |
| location | The [StockLocation](#stock-location) Where this [StockItem](#stock-item) is located | | location | The [StockLocation](#stock-location) Where this [StockItem](#stock-item) is located |
@ -263,7 +273,6 @@ Each part object has access to a lot of context variables about the part. The fo
| build | Link to a Build (if this stock item was created from a build) | | build | Link to a Build (if this stock item was created from a build) |
| is_building | Boolean field indicating if this stock item is currently being built (or is "in production") | | is_building | Boolean field indicating if this stock item is currently being built (or is "in production") |
| purchase_order | Link to a [PurchaseOrder](#purchase-order) (if this stock item was created from a PurchaseOrder) | | purchase_order | Link to a [PurchaseOrder](#purchase-order) (if this stock item was created from a PurchaseOrder) |
| infinite | If True this [StockItem](#stock-item) can never be exhausted |
| sales_order | Link to a [SalesOrder](#sales-order) object (if the StockItem has been assigned to a SalesOrder) | | sales_order | Link to a [SalesOrder](#sales-order) object (if the StockItem has been assigned to a SalesOrder) |
| purchase_price | The unit purchase price for this [StockItem](#stock-item) - this is the unit price at time of purchase (if this item was purchased from an external supplier) | | purchase_price | The unit purchase price for this [StockItem](#stock-item) - this is the unit price at time of purchase (if this item was purchased from an external supplier) |
| packaging | Description of how the StockItem is packaged (e.g. "reel", "loose", "tape" etc) | | packaging | Description of how the StockItem is packaged (e.g. "reel", "loose", "tape" etc) |
@ -277,7 +286,7 @@ Each part object has access to a lot of context variables about the part. The fo
| icon | The name of the icon if set, e.g. fas fa-warehouse | | icon | The name of the icon if set, e.g. fas fa-warehouse |
| item_count | Simply returns the number of stock items in this location | | item_count | Simply returns the number of stock items in this location |
| name | The name of the location. This is only the name of this location, not the path | | name | The name of the location. This is only the name of this location, not the path |
| owner | The owner of the location if it has one. The owner can only be assigned in the admin interface | | owner | The owner of the location if it has one |
| parent | The parent location. Returns None if it is already the top most one | | parent | The parent location. Returns None if it is already the top most one |
| path | A queryset of locations that contains the hierarchy starting from the top most parent | | path | A queryset of locations that contains the hierarchy starting from the top most parent |
| pathstring | A string that contains all names of the path separated by slashes e.g. A/B/C | | pathstring | A string that contains all names of the path separated by slashes e.g. A/B/C |
@ -298,8 +307,8 @@ Each part object has access to a lot of context variables about the part. The fo
| contact | Contact Name | | contact | Contact Name |
| phone | Contact phone number | | phone | Contact phone number |
| email | Contact email address | | email | Contact email address |
| link | A second URL to the company (Actually only accessible in the admin interface) | | link | URL associated with the company |
| notes | Extra notes about the company (Actually only accessible in the admin interface) | | notes | Extra notes about the company |
| is_customer | Boolean value, is this company a customer | | is_customer | Boolean value, is this company a customer |
| is_supplier | Boolean value, is this company a supplier | | is_supplier | Boolean value, is this company a supplier |
| is_manufacturer | Boolean value, is this company a manufacturer | | is_manufacturer | Boolean value, is this company a manufacturer |
@ -353,7 +362,7 @@ Each part object has access to a lot of context variables about the part. The fo
| Variable | Description | | Variable | Description |
|----------|-------------| |----------|-------------|
| username | the username of the user | | username | the username of the user |
| fist_name | The first name of the user | | first_name | The first name of the user |
| last_name | The last name of the user | | last_name | The last name of the user |
| email | The email address of the user | | email | The email address of the user |
| pk | The primary key of the user | | pk | The primary key of the user |

View File

@ -907,7 +907,7 @@ If you have a custom logo, but explicitly wish to load the InvenTree logo itself
## Report Assets ## Report Assets
[Report Assets](./index.md#report-assets) are files specifically uploaded by the user for inclusion in generated reports and labels. [Report Assets](./assets.md) are files specifically uploaded by the user for inclusion in generated reports and labels.
You can add asset images to the reports and labels by using the `{% raw %}{% asset ... %}{% endraw %}` template tag: You can add asset images to the reports and labels by using the `{% raw %}{% asset ... %}{% endraw %}` template tag:

View File

@ -53,29 +53,43 @@ To read more about the capabilities of the report templating engine, and how to
## Creating Templates ## Creating Templates
Report and label templates can be created (and edited) via the [admin interface](../settings/admin.md), under the *Report* section. Report and label templates are managed from the [Admin Center](../settings/admin.md#admin-center), which provides dedicated panels (under the *Reporting* group) for each template type:
Select the type of template you are wanting to create (a *Report Template* or *Label Template*) and press the *Add* button in the top right corner: - **Label Templates** - Create and edit [label templates](./labels.md)
- **Report Templates** - Create and edit [report templates](./report.md)
- **Report Snippets** - Manage reusable [snippet](#report-snippets) files
- **Report Assets** - Manage uploaded [asset](#report-assets) files
{{ image("report/report_template_admin.png", "Report template admin") }} Label and report templates are created and edited using the built-in [template editor](./template_editor.md), which allows templates to be written directly within the browser, with a live preview of the rendered output.
!!! tip "Staff Access Only" !!! tip "Staff Access Only"
Only users with staff access can upload or edit report template files. Only users with staff access can create, upload or edit templates, snippets and assets.
!!! info "Editing Reports" !!! info "Database Admin Interface"
Existing reports can be edited from the admin interface, in the same location as described above. To change the contents of the template, re-upload a template file, to override the existing template data. Templates can also be managed at a lower level via the [Database Admin interface](../settings/db_admin.md), under the *Report* section. This is recommended for advanced users only.
!!! tip "Template Editor"
InvenTree also provides a powerful [template editor](./template_editor.md) which allows for the creation and editing of report templates directly within the browser.
### Name and Description ### Name and Description
Each report template requires a name and description, which identify and describe the report template. Each report template requires a name and description, which identify and describe the report template.
### Revision
Each template has a revision number, which is automatically incremented each time the template is updated. This provides a simple mechanism for tracking changes to a template over time. The revision number is read-only, and cannot be edited directly.
!!! info "Template Revision Context"
The revision number of the template is made available when rendering, via the `template_revision` [context variable](./context_variables.md#global-context).
### Enabled Status ### Enabled Status
Boolean field which determines if the specific report template is enabled, and available for use. Reports can be disabled to remove them from the list of available templates, but without deleting them from the database. Boolean field which determines if the specific report template is enabled, and available for use. Reports can be disabled to remove them from the list of available templates, but without deleting them from the database.
### Attach to Model
If the *Attach to Model on Print* option is enabled, a copy of the generated report is automatically saved as a file attachment against the item (model instance) for which it was generated, each time the template is printed.
!!! warning "Attachment Support"
The report output is only attached if the target model type supports file attachments.
### Filename Pattern ### Filename Pattern
The filename pattern used to generate the output `.pdf` file. Defaults to "report.pdf". The filename pattern used to generate the output `.pdf` file. Defaults to "report.pdf".
@ -147,89 +161,15 @@ Setting the *Debug Mode* option renders the template as raw HTML instead of PDF,
## Report Assets ## Report Assets
User can upload asset files (e.g. images) which can be used when generating reports. For example, you may wish to generate a report with your company logo in the header. Asset files are uploaded via the admin interface. User can upload asset files (e.g. images) which can be used when generating reports. For example, you may wish to generate a report with your company logo in the header.
Asset files can be rendered directly into the template as follows
```html
{% raw %}
<!-- Need to include the report template tags at the start of the template file -->
{% load report %}
<!-- Simple stylesheet -->
<head>
<style>
.company-logo {
height: 50px;
}
</style>
</head>
<body>
<!-- Report template code here -->
<!-- Render an uploaded asset image -->
<img src="{% asset 'company_image.png' %}" class="company-logo">
<!-- ... -->
</body>
{% endraw %}
```
!!! warning "Asset Naming"
If the requested asset name does not match the name of an uploaded asset, the template will continue without loading the image.
!!! info "Assets location"
Upload new assets via the [admin interface](../settings/admin.md) to ensure they are uploaded to the correct location on the server.
Refer to the [report assets](./assets.md) documentation for further information.
## Report Snippets ## Report Snippets
A powerful feature provided by the django / WeasyPrint templating framework is the ability to include external template files. This allows commonly used template features to be broken out into separate files and reused across multiple templates. InvenTree provides report "snippets" - reusable template files which cannot be rendered by themselves, but can be included in other templates.
To support this, InvenTree provides report "snippets" - short (or not so short) template files which cannot be rendered by themselves, but can be called from other templates. Refer to the [report snippets](./snippets.md) documentation for further information.
Similar to assets files, snippet template files are uploaded via the admin interface.
Snippets are included in a template as follows:
```
{% raw %}{% include 'snippets/<snippet_name.html>' %}{% endraw %}
```
For example, consider a custom stocktake report for a particular stock location, where we wish to render a table with a row for each item in that location.
```html
{% raw %}
<table class='stock-table'>
<thead>
<!-- table header data -->
</thead>
<tbody>
{% for item in location.stock_items %}
{% include 'snippets/stock_row.html' with item=item %}
{% endfor %}
</tbody>
{% endraw %}
```
!!! info "Snippet Arguments"
Note above that named argument variables can be passed through to the snippet!
And the snippet file `stock_row.html` may be written as follows:
```html
{% raw %}
<!-- stock_row snippet -->
<tr>
<td>{{ item.part.full_name }}</td>
<td>{{ item.quantity }}</td>
</tr>
{% endraw %}
```
## Security ## Security
@ -243,7 +183,7 @@ When WeasyPrint renders a template to PDF it can make outbound requests to load
|---|---| |---|---|
| `data:` URIs | Always permitted — self-contained, no network access | | `data:` URIs | Always permitted — self-contained, no network access |
| `file://` | Always blocked — assets and images must be inlined as `data:` URIs before reaching WeasyPrint | | `file://` | Always blocked — assets and images must be inlined as `data:` URIs before reaching WeasyPrint |
| `http` / `https` | Disabled by default, but can be blocked - see *Remote URL Fetching* below | | `http` / `https` | Disabled by default, but can be enabled - see *Remote URL Fetching* below |
| Any other scheme | Always blocked | | Any other scheme | Always blocked |
HTTP redirects are also disabled: a URL that passes validation cannot redirect to an internal address. HTTP redirects are also disabled: a URL that passes validation cannot redirect to an internal address.
@ -259,6 +199,6 @@ When enabled, URLs are still validated against private, loopback, link-local, an
### Asset Files ### Asset Files
Asset files uploaded through the admin interface are embedded directly into the rendered PDF as base64 `data:` URIs — they are read via the Django storage API and never loaded through WeasyPrint's URL fetcher. This means assets work correctly regardless of whether remote URL fetching is enabled, and also work with remote storage backends such as S3. [Asset files](./assets.md) uploaded through the admin interface are embedded directly into the rendered PDF as base64 `data:` URIs — they are read via the Django storage API and never loaded through WeasyPrint's URL fetcher. This means assets work correctly regardless of whether remote URL fetching is enabled, and also work with remote storage backends such as S3.
There are various [helper functions](./helpers.md#report-assets) available to assist with embedding assets into templates. There are various [helper functions](./helpers.md#report-assets) available to assist with embedding assets into templates.

View File

@ -128,6 +128,25 @@ As an example, consider a label template for a StockItem. A user may wish to def
To restrict the label accordingly, we could set the *filters* value to `part__IPN=IPN123`. To restrict the label accordingly, we could set the *filters* value to `part__IPN=IPN123`.
## Printing Labels
Labels are printed directly from the web interface, from the pages where the target items are displayed. To print labels against one or more items:
1. Select the items to print - either from a table (using the row checkboxes), or by viewing the detail page of a single item
2. Select the *Print* action, and choose the *Print Label* option
3. Select the desired label template - only *enabled* templates which match the selected model type (and pass any template filters) are available for selection
4. Select the *printer* (plugin) to use for printing the labels
### Label Printing Plugins
The actual printing of labels is handled by a [label printing plugin](../plugins/mixins/label.md). InvenTree provides a number of built-in printing plugins:
- The default [InvenTree Label Printer](../plugins/builtin/inventree_label.md) plugin generates a PDF file, which is then made available for download.
- The [Label Sheet](../plugins/builtin/inventree_label_sheet.md) plugin arranges multiple labels onto a single sheet for printing.
- The [Label Machine](../plugins/builtin/inventree_label_machine.md) plugin sends the label to an external [label printer machine](../plugins/machines/label_printer.md).
Custom label printing plugins (e.g. for driving a specific hardware printer) can be installed to extend this list - refer to the [label mixin documentation](../plugins/mixins/label.md) for further information.
## Built-In Templates ## Built-In Templates
The InvenTree installation provides a number of simple *default* templates which can be used as a starting point for creating custom labels. These built-in templates can be disabled if they are not required. The InvenTree installation provides a number of simple *default* templates which can be used as a starting point for creating custom labels. These built-in templates can be disabled if they are not required.

View File

@ -1,53 +1,51 @@
--- ---
title: Report and Label Generation title: Report Templates
--- ---
## Custom Reports ## Report Templates
InvenTree supports a customizable reporting ecosystem, allowing the user to develop document templates that meet their particular needs. Report templates are used to generate formal PDF documents - such as order reports, packing lists, or test reports - rendered against a particular database item (or list of items).
PDF files are generated from custom HTML template files which are written by the user. Like all InvenTree templates, report templates are written using a mixture of HTML / CSS and the django template language, and are rendered to a PDF file using the WeasyPrint engine:
Templates can be used to generate *reports* or *labels* which can be used in a variety of situations to format data in a friendly format for printing, distribution, conformance and testing. - Refer to the [template overview](./index.md) for information on creating and managing templates.
- Refer to the [template rendering documentation](./weasyprint.md) for information on the WeasyPrint engine and the django template language.
- Refer to the [context variables documentation](./context_variables.md) for the variables available when rendering a template.
In addition to providing the ability for end-users to provide their own reporting templates, some report types offer "built-in" report templates ready for use. ## Report Options
### WeasyPrint Templates In addition to the [options common to all templates](./index.md#creating-templates), each report template provides the following options:
InvenTree report templates utilize the powerful [WeasyPrint](https://weasyprint.org/) PDF generation engine. ### Page Size
!!! info "WeasyPrint" The page size (e.g. `A4` or `Letter`) used when rendering the report to a PDF file. When a new report template is created, this value defaults to the [default page size](./index.md#default-page-size) specified in the global settings.
WeasyPrint is an extremely powerful and flexible reporting library. Refer to the [WeasyPrint docs](https://doc.courtbouillon.org/weasyprint/stable/) for further information.
### Stylesheets ### Landscape
Templates are rendered using standard HTML / CSS - if you are familiar with web page layout, you're ready to go! If enabled, the report is rendered in landscape orientation, rather than the default portrait orientation.
### Template Language ### Merge
Uploaded report template files are passed through the [django template rendering framework]({% include "django.html" %}/topics/templates/), and as such accept the same variable template strings as any other django template file. Different variables are passed to the report template (based on the context of the report) and can be used to customize the contents of the generated PDF. If enabled, a single report document is generated for all selected items, rather than a separate document for each item. Refer to the [merging reports](#merging-reports) section below for further information.
### Variables !!! info "Context Variables"
The `page_size`, `landscape` and `merge` values are also made available to the template as [context variables](./context_variables.md#report-context).
Each report template is provided a set of *context variables* which can be used when rendering the template. ## Generating Reports
For example, rendering the name of a part (which is available in the particular template context as `part`) is as follows: Reports are generated directly from the web interface, from the pages where the target items are displayed. To generate a report against one or more items:
```html 1. Select the items to print - either from a table (using the row checkboxes), or by viewing the detail page of a single item
{% raw %} 2. Select the *Print* action, and choose the *Print Report* option
3. Select the desired report template - only *enabled* templates which match the selected model type (and pass any [template filters](./index.md#template-filters)) are available for selection
4. The report is generated by the server, and the resulting PDF file is made available for download
<!-- Template variables use {{ double_curly_braces }} --> !!! info "Enable Reports"
<h2>Part: {{ part.name }}</h3> Report generation must be [enabled in the global settings](./index.md#enable-reports) before reports can be generated.
<p><i>
Description:<br>
{{ part.description }}
</p></i>
{% endraw %}
```
## Merging Reports ## Merging Reports
When rendering reports for multiple items, the default behaviour is that each item is rendered as a separate report. The chosen templeate is rendered multiple times, once for each item selected, and expects a single item in the context variable. When rendering reports for multiple items, the default behaviour is that each item is rendered as a separate report. The chosen template is rendered multiple times, once for each item selected, and expects a single item in the context variable.
However, it is possible to merge multiple items into a single report document. This is achieved by enabling the `merge` attribute of the report template: However, it is possible to merge multiple items into a single report document. This is achieved by enabling the `merge` attribute of the report template:

View File

@ -22,6 +22,7 @@ The following report templates are provided "out of the box" and can be used as
| [Sales Order Shipment](#sales-order-shipment) | [SalesOrderShipment](../sales/sales_order.md) | Sales Order Shipment report | | [Sales Order Shipment](#sales-order-shipment) | [SalesOrderShipment](../sales/sales_order.md) | Sales Order Shipment report |
| [Stock Location](#stock-location) | [StockLocation](../stock/index.md#stock-location) | Stock Location report | | [Stock Location](#stock-location) | [StockLocation](../stock/index.md#stock-location) | Stock Location report |
| [Test Report](#test-report) | [StockItem](../stock/index.md#stock-item) | Test Report | | [Test Report](#test-report) | [StockItem](../stock/index.md#stock-item) | Test Report |
| [Transfer Order](#transfer-order) | [TransferOrder](../stock/transfer_order.md) | Transfer Order report |
| [Selected Stock Items Report](#selected-stock-items-report) | [StockItem](../stock/index.md#stock-item) | Selected Stock Items report | | [Selected Stock Items Report](#selected-stock-items-report) | [StockItem](../stock/index.md#stock-item) | Selected Stock Items report |
@ -57,6 +58,10 @@ The following report templates are provided "out of the box" and can be used as
{{ templatefile("report/inventree_test_report.html") }} {{ templatefile("report/inventree_test_report.html") }}
### Transfer Order
{{ templatefile("report/inventree_transfer_order_report.html") }}
### Selected Stock Items Report ### Selected Stock Items Report
{{ templatefile("report/inventree_stock_report_merge.html") }} {{ templatefile("report/inventree_stock_report_merge.html") }}
@ -68,9 +73,11 @@ The following label templates are provided "out of the box" and can be used as a
| Template | Model Type | Description | | Template | Model Type | Description |
| --- | --- | --- | | --- | --- | --- |
| [Build Line](#build-line-label) | [Build line item](../manufacturing/build.md) | Build Line label | | [Build Line](#build-line-label) | [Build line item](../manufacturing/build.md) | Build Line label |
| [Part](#part-label) | [Part](../part/index.md) | Part label | | [Part](#part-label) | [Part](../part/index.md) | Part label (QR code and part name) |
| [Part (Code128)](#part-label-code128) | [Part](../part/index.md) | Part label (Code128 barcode) |
| [Stock Item](#stock-item-label) | [StockItem](../stock/index.md#stock-item) | Stock Item label | | [Stock Item](#stock-item-label) | [StockItem](../stock/index.md#stock-item) | Stock Item label |
| [Stock Location](#stock-location-label) | [StockLocation](../stock/index.md#stock-location) | Stock Location label | | [Stock Location](#stock-location-label) | [StockLocation](../stock/index.md#stock-location) | Stock Location label (QR code) |
| [Stock Location (with text)](#stock-location-label-with-text) | [StockLocation](../stock/index.md#stock-location) | Stock Location label (QR code and location details) |
### Build Line Label ### Build Line Label
@ -78,6 +85,10 @@ The following label templates are provided "out of the box" and can be used as a
### Part Label ### Part Label
{{ templatefile("label/part_label.html") }}
### Part Label (Code128)
{{ templatefile("label/part_label_code128.html") }} {{ templatefile("label/part_label_code128.html") }}
### Stock Item Label ### Stock Item Label
@ -86,4 +97,8 @@ The following label templates are provided "out of the box" and can be used as a
### Stock Location Label ### Stock Location Label
{{ templatefile("label/stocklocation_qr.html") }}
### Stock Location Label (with text)
{{ templatefile("label/stocklocation_qr_and_text.html") }} {{ templatefile("label/stocklocation_qr_and_text.html") }}

View File

@ -0,0 +1,52 @@
---
title: Report Snippets
---
## Report Snippets
A powerful feature provided by the django / WeasyPrint templating framework is the ability to include external template files. This allows commonly used template features to be broken out into separate files and reused across multiple templates.
To support this, InvenTree provides report "snippets" - short (or not so short) template files which cannot be rendered by themselves, but can be called from other templates.
Snippet files are managed from the [Admin Center](../settings/admin.md#admin-center), via the *Report Snippets* panel. Staff users can upload new snippet files, and edit or remove existing snippets.
Additionally, the content of an existing snippet can be modified directly within the browser - simply select a snippet from the table to open it in the built-in [template editor](./template_editor.md#editing-snippets).
Snippets are included in a template as follows:
```
{% raw %}{% include 'snippets/<snippet_name.html>' %}{% endraw %}
```
For example, consider a custom stocktake report for a particular stock location, where we wish to render a table with a row for each item in that location.
```html
{% raw %}
<table class='stock-table'>
<thead>
<!-- table header data -->
</thead>
<tbody>
{% for item in location.stock_items %}
{% include 'snippets/stock_row.html' with item=item %}
{% endfor %}
</tbody>
{% endraw %}
```
!!! info "Snippet Arguments"
Note above that named argument variables can be passed through to the snippet!
And the snippet file `stock_row.html` may be written as follows:
```html
{% raw %}
<!-- stock_row snippet -->
<tr>
<td>{{ item.part.full_name }}</td>
<td>{{ item.quantity }}</td>
</tr>
{% endraw %}
```

View File

@ -4,11 +4,11 @@ title: Template editor
## Template editor ## Template editor
The Template Editor is integrated into the [Admin Center](../settings//admin.md#admin-center) of the Web UI. It allows users to create and edit label and report templates directly with a side by side preview for a more productive workflow. The Template Editor is integrated into the [Admin Center](../settings/admin.md#admin-center) of the Web UI. It allows users to create and edit label and report templates directly with a side by side preview for a more productive workflow.
![Template Table](../assets/images/report/template-table.png) ![Template Table](../assets/images/report/template-table.png)
On the left side (1) are all possible possible template types for labels and reports listed. With the "+" button (2), above the template table (3), new templates for the selected type can be created. To switch to the template editor click on a template. On the left side (1) are all possible template types for labels and reports listed. With the "+" button (2), above the template table (3), new templates for the selected type can be created. To switch to the template editor click on a template.
### Editing Templates ### Editing Templates
@ -31,3 +31,10 @@ If you don't want to override the template, but just render a preview for a temp
#### Edit template metadata #### Edit template metadata
Editing metadata such as name, description, filters and even width/height for labels and orientation/page size for reports can be done from the edit modal accessible when clicking on the three dots (4) and select "Edit" in the dropdown menu. Editing metadata such as name, description, filters and even width/height for labels and orientation/page size for reports can be done from the edit modal accessible when clicking on the three dots (4) and select "Edit" in the dropdown menu.
### Editing Snippets
[Report snippets](./index.md#report-snippets) can also be edited directly within the browser, from the *Report Snippets* panel in the Admin Center. Selecting a snippet from the table opens it in the same code editor as used for report and label templates.
!!! info "No Preview"
As snippets cannot be rendered by themselves (they must be included in a report or label template), no preview area is available when editing a snippet.

View File

@ -16,4 +16,4 @@ To make MFA mandatory for all users:
### Security Consideration ### Security Consideration
A user can lock themselves out if they lose access to both the device with their TOTP app and their backup tokens. An admin can delete their tokens from the admin pages (they exist under the 'TOTP devices' / 'static devices' models) . This should be a last resort and only done by people knowledgeable about the [admin pages](../settings/admin.md) as changes there might circumvent InvenTree's business and security logic. A user can lock themselves out if they lose access to both the device with their TOTP app and their backup tokens. An admin can delete their tokens from the Database Admin interface (they exist under the 'TOTP devices' / 'static devices' models). This should be a last resort and only done by people knowledgeable about the [Database Admin interface](../settings/db_admin.md), as changes there might circumvent InvenTree's business and security logic.

View File

@ -18,7 +18,7 @@ The basic requirements for configuring SSO are outlined below:
1. Enable backend for each required SSO provider(s) in the [config file or environment variables](../start/config.md#single-sign-on). 1. Enable backend for each required SSO provider(s) in the [config file or environment variables](../start/config.md#single-sign-on).
1. Create an external *app* with your provider of choice 1. Create an external *app* with your provider of choice
1. Add the required client configurations in the `SocialApp` app in the [admin interface](../settings/admin.md). 1. Add the required client configurations in the `SocialApp` app in the [Database Admin interface](../settings/db_admin.md).
1. Configure the *callback* URL for the external app. 1. Configure the *callback* URL for the external app.
1. Enable SSO for the users in the [global settings](../settings/global.md). 1. Enable SSO for the users in the [global settings](../settings/global.md).
1. Configure [e-mail](../settings/email.md). 1. Configure [e-mail](../settings/email.md).
@ -161,4 +161,4 @@ Make sure all users with admin privileges have sufficient passwords - they can r
## Error Handling ## Error Handling
If you encounter an error during the SSO process, the error should be logged in the InvenTree database. You can view the [error log](./logs.md) in the [admin interface](./admin.md) to see the details of the error. If you encounter an error during the SSO process, the error should be logged in the InvenTree database. You can view the [error log](./logs.md) in the [Admin Center](./admin.md#admin-center) to see the details of the error.

View File

@ -4,24 +4,23 @@ title: InvenTree Admin Interfaces
## InvenTree Admin Interfaces ## InvenTree Admin Interfaces
There are multiple administration interfaces available in InvenTree, which provide different levels of access to the underlying resources and different operational safety. InvenTree provides multiple administration interfaces with different safety levels and intended use cases.
[**Admin Center**](#admin-center): [**Admin Center**](#admin-center):
- Main interface for managing InvenTree - Main administration interface for day-to-day operations
- Robust verification and safety checks - Uses API-backed flows with validation and safety checks
[**System Settings**](#system-settings): [**System Settings**](#system-settings):
- Access to all settings - Access to global runtime settings
- Robust verification, requires reading the documentation - Available to staff users (or users with equivalent API scope)
[**Backend Admin Interface**](#backend-admin-interface): [**Database Admin Interface**](./db_admin.md):
- Low level access to the database - Low-level database administration
- Few verification or safety checks - Fewer safeguards than the Admin Center
- Requires knowledge of InvenTree internals - Intended for advanced users and troubleshooting scenarios
- Recommended for advanced users only
### Admin Center ### Admin Center
@ -34,7 +33,13 @@ The Admin Center is the main interface for managing InvenTree. It provides a use
- Integration with external services (via machines and plugins) - Integration with external services (via machines and plugins)
- Reporting and statistics - Reporting and statistics
It can be access via the *Admin Center* link in the top right user menu, the *Admin Center* quick-link in the command palette, or via the navigation menu. #### Access Admin Center
The Admin Center can be accessed in any of the following ways:
- User menu in the top-right corner: *Admin Center*
- Command palette quick action: *Admin Center*
- Direct URL: `/web/settings/admin`
#### Permissions #### Permissions
@ -44,40 +49,6 @@ Some panes can only be accessed by users with specific permissions. For example,
The System Settings interface provides ordered access to all global settings in InvenTree. Users need to have _staff_ privileges enabled or the _a:staff_ scope. The System Settings interface provides ordered access to all global settings in InvenTree. Users need to have _staff_ privileges enabled or the _a:staff_ scope.
### Backend Admin Interface ### Database Admin Interface
Users which have *staff* privileges have access to an Admin interface which provides extremely low level control of the database. Every item in the database is available and this interface provides a unrestricted option for directly viewing and modifying database objects. For low-level administration tasks, use the [Database Admin Interface](./db_admin.md).
!!! warning "Caution"
Admin users should exercise extreme care when modifying data via the admin interface, as performing the wrong action may have unintended consequences!
The admin interface allows *staff* users the ability to directly view / add / edit / delete database entries according to their [user permissions](./permissions.md).
#### Access Backend Admin Interface
To directly access the admin interface, append /admin/ to the InvenTree site URL - e.g. http://localhost:8000/admin/.
An administration panel will be presented as shown below:
{{ image("admin/admin.png", "Admin panel") }}
#### View Database Objects
Database objects can be listed and filtered directly. The image below shows an example of displaying existing part categories.
{{ image("admin/part_cats.png", "Part categories") }}
!!! info "Permissions"
A "staff" account does not necessarily provide access to all administration options, depending on the roles assigned to the user.
##### Filtering
Some admin views support filtering of results against specified criteria. For example, the list of Part objects can be filtered as follows:
{{ image("admin/filter.png", "Filter part list") }}
#### Edit Database Objects
Individual database objects can be edited directly in the admin interface. The image below shows an example of editing a Part object:
{{ image("admin/edit_part.png", "Edit part") }}

View File

@ -0,0 +1,54 @@
---
title: InvenTree Database Admin Interface
---
## Database Admin Interface
The Database Admin interface provides low-level access to InvenTree database objects.
!!! danger "Low-Level Interface"
The Database Admin bypasses many of the application-level safety checks used in the Admin Center.
Incorrect edits can create inconsistent data, break workflows, or expose security issues.
Use this interface only if you understand the data model and operational impact.
!!! warning "Recommended Usage"
Prefer the [Admin Center](./admin.md#admin-center) for routine administration.
Use the Database Admin only for advanced administration and troubleshooting.
### Access Database Admin Interface
Access to the Database Admin requires a user account with *staff* privileges.
Use one of the following methods:
- Append `/admin/` to the base InvenTree URL (for example: `http://localhost:8000/admin/`)
- Use the configured administrator URL from `INVENTREE_ADMIN_URL`
{{ image("admin/admin.png", "Database Admin panel") }}
### Permissions
A "staff" account does not necessarily provide access to all administration options, depending on the roles assigned to the user.
### View Database Objects
Database objects can be listed and filtered directly. The image below shows an example of displaying existing part categories.
{{ image("admin/part_cats.png", "Part categories") }}
#### Filtering
Some admin views support filtering of results against specified criteria. For example, the list of Part objects can be filtered as follows:
{{ image("admin/filter.png", "Filter part list") }}
### Edit Database Objects
Individual database objects can be edited directly in the Database Admin interface. The image below shows an example of editing a Part object:
{{ image("admin/edit_part.png", "Edit part") }}
!!! danger "Before You Save Changes"
Verify your changes carefully before saving.
If possible, test changes in a non-production environment first.
Record what you changed so it can be reviewed and reverted if needed.

View File

@ -226,6 +226,7 @@ Configuration of stock item options
{{ globalsetting("STOCK_SHOW_INSTALLED_ITEMS") }} {{ globalsetting("STOCK_SHOW_INSTALLED_ITEMS") }}
{{ globalsetting("STOCK_ENFORCE_BOM_INSTALLATION") }} {{ globalsetting("STOCK_ENFORCE_BOM_INSTALLATION") }}
{{ globalsetting("STOCK_ALLOW_OUT_OF_STOCK_TRANSFER") }} {{ globalsetting("STOCK_ALLOW_OUT_OF_STOCK_TRANSFER") }}
{{ globalsetting("STOCK_MERGE_ON_TRANSFER") }}
{{ globalsetting("TEST_STATION_DATA") }} {{ globalsetting("TEST_STATION_DATA") }}
### Build Orders ### Build Orders

View File

@ -1,22 +1,19 @@
--- ---
title: Admin Shell title: Error Logs
--- ---
## Error Logs ## Error Logs
Any critical server error logs are recorded to the database, and can be viewed by staff users using the admin interface. Any critical server error logs are recorded to the database, and can be viewed by staff users in the [Admin Center](./admin.md#admin-center), under the *Error Reports* section:
In the admin interface, select the "Errors" view: {{ image("admin/admin_errors_link.png", "Error Reports in the Admin Center") }}
{{ image("admin/admin_errors_link.png", "Admin errors") }} A list of error logs is presented. Select an entry to view the full error details, including the traceback.
!!! info "URL"
Alternatively, navigate to the error list view at /admin/error_report/error/
A list of error logs is presented.
{{ image("admin/admin_errors.png", "Error logs") }} {{ image("admin/admin_errors.png", "Error logs") }}
!!! info "Database Admin Interface"
Error logs can also be viewed via the [Database Admin interface](./db_admin.md), at the URL `/admin/error_report/error/`
!!! info "Deleting Logs" !!! info "Deleting Logs"
Error logs should be deleted periodically Error logs should be deleted periodically

View File

@ -7,7 +7,7 @@ title: User Permissions
InvenTree provides access control to various features and data, by assigning each *user* to one (or more) *groups* which have multiple *roles* assigned. InvenTree provides access control to various features and data, by assigning each *user* to one (or more) *groups* which have multiple *roles* assigned.
!!! info "Superuser" !!! info "Superuser"
The superuser account is afforded *all* permissions across an InvenTree installation. This includes the admin interface, web interface, and API. The superuser account is afforded *all* permissions across an InvenTree installation. This includes the [Database Admin interface](./db_admin.md), web interface, and API.
### User ### User
@ -54,7 +54,7 @@ Within each role, there are four levels of available permissions:
## Dangerous User Flags ## Dangerous User Flags
In addition to the above permissions, there are two special flags that can be assigned to a user: In addition to the above permissions, there are two special flags that can be assigned to a user:
- **Staff** - A user with the *staff* flag is able to access the admin interface, and can trigger dangerous actions that might have a security impact such as changing parsable files on the server (templates / reports / plugins). Some of these actions require the *admin* role to be assigned as well. - **Staff** - A user with the *staff* flag is able to access the [Database Admin interface](./db_admin.md), and can trigger dangerous actions that might have a security impact such as changing parsable files on the server (templates / reports / plugins). Some of these actions require the *admin* role to be assigned as well.
- **Superuser** - A user with the *superuser* flag is able to access and change all data and functions of InvenTree. A superuser can modify and access all data that the InvenTree installation / server has access to - including shell access on the server OS itself. This is a very powerful flag, and should be used with caution. - **Superuser** - A user with the *superuser* flag is able to access and change all data and functions of InvenTree. A superuser can modify and access all data that the InvenTree installation / server has access to - including shell access on the server OS itself. This is a very powerful flag, and should be used with caution.
It is strongly recommended to register any users with staff / superuser flags with strong MFA methods to reduce the risk of unauthorized access. These accounts should be used with caution, and should not be used for day-to-day operations. It is strongly recommended to register any users with staff / superuser flags with strong MFA methods to reduce the risk of unauthorized access. These accounts should be used with caution, and should not be used for day-to-day operations.
@ -62,11 +62,11 @@ It is strongly recommended to register any users with staff / superuser flags wi
Practicing account tiering is strongly recommended. Practicing account tiering is strongly recommended.
## Admin Interface Permissions ## Database Admin Permissions
If a user does not have the required permissions to perform a certain action in the admin interface, those options not be displayed. If a user does not have the required permissions to perform a certain action in the [Database Admin interface](./db_admin.md), those options will not be displayed.
If a user is expecting a certain option to be available in the admin interface, but it is not present, it is most likely the case that the user does not have those permissions assigned. If a user is expecting a certain option to be available in the Database Admin interface, but it is not present, it is most likely the case that the user does not have those permissions assigned.
## Web Interface Permissions ## Web Interface Permissions

View File

@ -24,6 +24,6 @@ The Django Q work must run separately to the web server. This is started as a se
If the worker is not running, a warning indicator is displayed in the InvenTree menu bar. If the worker is not running, a warning indicator is displayed in the InvenTree menu bar.
## Admin Interface ## Admin Center
Scheduled tasks can be viewed in the InvenTree admin interface. Scheduled, pending and failed tasks can be viewed in the [Admin Center](./admin.md#admin-center), under the *Background Tasks* section.

View File

@ -65,7 +65,7 @@ The following basic options are available:
{{ configsetting("INVENTREE_SITE_URL") }} Specify a fixed site URL | {{ configsetting("INVENTREE_SITE_URL") }} Specify a fixed site URL |
{{ configsetting("INVENTREE_TIMEZONE") }} Server timezone | {{ configsetting("INVENTREE_TIMEZONE") }} Server timezone |
{{ configsetting("INVENTREE_ADMIN_ENABLED") }} Enable the [django administrator interface]({% include "django.html" %}/ref/contrib/admin/) | {{ configsetting("INVENTREE_ADMIN_ENABLED") }} Enable the [django administrator interface]({% include "django.html" %}/ref/contrib/admin/) |
{{ configsetting("INVENTREE_ADMIN_URL") }} URL for accessing [admin interface](../settings/admin.md) | {{ configsetting("INVENTREE_ADMIN_URL") }} URL for accessing the [Database Admin interface](../settings/db_admin.md) |
{{ configsetting("INVENTREE_LANGUAGE") }} Default language | {{ configsetting("INVENTREE_LANGUAGE") }} Default language |
{{ configsetting("INVENTREE_AUTO_UPDATE") }} Database migrations will be run automatically | {{ configsetting("INVENTREE_AUTO_UPDATE") }} Database migrations will be run automatically |

View File

@ -325,7 +325,7 @@ ARG INVENTREE_TAG
# prebuild stage - needs a lot of build dependencies # prebuild stage - needs a lot of build dependencies
# make sure, the alpine and python version matches the version used in the inventree base image # make sure, the alpine and python version matches the version used in the inventree base image
FROM python:3.11-alpine3.18 as prebuild FROM python:3.12-alpine3.18 as prebuild
# Install whatever development dependency is needed (e.g. cups-dev, gcc, the musl-dev build tools and the pip pycups package) # Install whatever development dependency is needed (e.g. cups-dev, gcc, the musl-dev build tools and the pip pycups package)
RUN apk add --no-cache cups-dev gcc musl-dev && \ RUN apk add --no-cache cups-dev gcc musl-dev && \

View File

@ -130,6 +130,7 @@ nav:
- Parts: part/index.md - Parts: part/index.md
- Creating Parts: part/create.md - Creating Parts: part/create.md
- Virtual Parts: part/virtual.md - Virtual Parts: part/virtual.md
- Consumable Parts: part/consumable.md
- Part Views: part/views.md - Part Views: part/views.md
- Tracking: part/trackable.md - Tracking: part/trackable.md
- Revisions: part/revision.md - Revisions: part/revision.md
@ -174,6 +175,8 @@ nav:
- Template Editor: report/template_editor.md - Template Editor: report/template_editor.md
- Reports: report/report.md - Reports: report/report.md
- Labels: report/labels.md - Labels: report/labels.md
- Report Assets: report/assets.md
- Report Snippets: report/snippets.md
- Context Variables: report/context_variables.md - Context Variables: report/context_variables.md
- Helper Functions: report/helpers.md - Helper Functions: report/helpers.md
- Barcodes: report/barcodes.md - Barcodes: report/barcodes.md
@ -182,7 +185,8 @@ nav:
- Global Settings: settings/global.md - Global Settings: settings/global.md
- User Settings: settings/user.md - User Settings: settings/user.md
- Reference Patterns: settings/reference.md - Reference Patterns: settings/reference.md
- Admin Interface: settings/admin.md - Admin Center: settings/admin.md
- Database Admin Interface: settings/db_admin.md
- Setup: - Setup:
- User Permissions: settings/permissions.md - User Permissions: settings/permissions.md
- Single Sign on: settings/SSO.md - Single Sign on: settings/SSO.md
@ -366,7 +370,7 @@ extra:
# provider: google # provider: google
# property: UA-143467500-1 # property: UA-143467500-1
min_python_version: 3.11 min_python_version: 3.12
min_invoke_version: 2.0.0 min_invoke_version: 2.0.0
django_version: 5.2 django_version: 5.2
docker_postgres_version: 17 docker_postgres_version: 17

View File

@ -31,9 +31,6 @@
}, },
{ {
"pattern": "https://opensource.org/license/MIT" "pattern": "https://opensource.org/license/MIT"
},
{
"pattern": "^https://dev.azure.com"
} }
] ]
} }

View File

@ -97,7 +97,7 @@ skip-magic-trailing-comma = true
line-ending = "auto" line-ending = "auto"
[tool.uv.pip] [tool.uv.pip]
python-version = "3.11" python-version = "3.12"
no-strip-extras=true no-strip-extras=true
generate-hashes=true generate-hashes=true
@ -105,17 +105,16 @@ generate-hashes=true
extra-paths = ["src/backend/InvenTree"] extra-paths = ["src/backend/InvenTree"]
[tool.ty.rules] [tool.ty.rules]
unresolved-reference="ignore" # 21 # see https://github.com/astral-sh/ty/issues/220 unresolved-attribute="ignore" # 837 # need Plugin Mixin typing
unresolved-attribute="ignore" # 505 # need Plugin Mixin typing
call-non-callable="ignore" # 8 ## call-non-callable="ignore" # 8 ##
invalid-assignment="ignore" # 17 # need to wait for better django field stubs invalid-assignment="ignore" # 40 # need to wait for better django field stubs
invalid-method-override="ignore" # 104 invalid-method-override="ignore" # 103
invalid-return-type="ignore" # 22 ## invalid-return-type="ignore" # 44 ##
# possibly-missing-attribute="ignore" # 25 # https://github.com/astral-sh/ty/issues/164
unknown-argument="ignore" # 3 # need to wait for better django field stubs
invalid-argument-type="ignore" # 49 invalid-argument-type="ignore" # 49
no-matching-overload="ignore" # 3 # need to wait for betterdjango field stubs no-matching-overload="ignore" # 10 # need to wait for betterdjango field stubs
# possibly-unbound-attribute="ignore" # 21
# warn about unused ignore comments
unused-ignore-comment = "error"
[tool.coverage.run] [tool.coverage.run]
source = ["src/backend/InvenTree", "InvenTree"] source = ["src/backend/InvenTree", "InvenTree"]

View File

@ -9,9 +9,9 @@ python:
- requirements: src/backend/requirements.txt - requirements: src/backend/requirements.txt
build: build:
os: "ubuntu-22.04" os: "ubuntu-24.04"
tools: tools:
python: "3.11" python: "3.12"
jobs: jobs:
post_install: post_install:
- pip install -U invoke - pip install -U invoke

View File

@ -1,11 +1,39 @@
"""InvenTree API version information.""" """InvenTree API version information."""
# InvenTree API version # InvenTree API version
INVENTREE_API_VERSION = 511 INVENTREE_API_VERSION = 519
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" """Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """ INVENTREE_API_TEXT = """
v519 -> 2026-07-09 : https://github.com/inventree/InvenTree/pull/TODO
- Adds optional "roles" and "permissions" fields to the /user/me/ API endpoint, via the "?roles=true" query parameter
v518 -> 2026-07-09 : https://github.com/inventree/InvenTree/pull/12341
- Enable import of internal part prices via the API
v517 -> 2026-07-08 : https://github.com/inventree/InvenTree/pull/12336
- Fix currency code options for the PartPricing model and API endpoints
v516 -> 2026-07-03 : https://github.com/inventree/InvenTree/pull/12295
- Adds "consumable" field to the Part model and API endpoints
v515 -> 2026-07-03 : https://github.com/inventree/InvenTree/pull/12298
- Change the file fields definition to binary (from uri) in the upload requests
v514 -> 2026-07-02 : https://github.com/inventree/InvenTree/pull/12294
- Adds "duplicate" field to the BuildOrder, Company, ManufacturerPart, SupplierPart and SalesOrderShipment API endpoints
- Order duplication options: renames "order_id" field to "original", which now performs primary-key validation
- Part duplication options: renames "part" field to "original"
v513 -> 2026-06-25 : https://github.com/inventree/InvenTree/pull/12250
- Adds "active" field to the ProjectCode model and API endpoints
v512 -> 2026-06-20 : https://github.com/inventree/InvenTree/pull/12022
- Adds optional "merge" field to each item in the Stock Transfer API endpoint
- When merge is enabled, transferred stock is combined into compatible existing stock at the destination
- Stock merge tracking entries now include an "added" delta field.
v511 -> 2026-06-19 : https://github.com/inventree/InvenTree/pull/12204 v511 -> 2026-06-19 : https://github.com/inventree/InvenTree/pull/12204
- Adds new filtering options to PartCategoryTree and StockLocationTree API endpoints - Adds new filtering options to PartCategoryTree and StockLocationTree API endpoints

View File

@ -25,6 +25,7 @@ def log_error(
error_data: Optional[str] = None, error_data: Optional[str] = None,
scope: Optional[str] = None, scope: Optional[str] = None,
plugin: Optional[str] = None, plugin: Optional[str] = None,
user_id: Optional[int] = None,
): ):
"""Log an error to the database. """Log an error to the database.
@ -37,6 +38,7 @@ def log_error(
error_data: The error data (optional, overrides 'data') error_data: The error data (optional, overrides 'data')
scope: The scope of the error (optional) scope: The scope of the error (optional)
plugin: The plugin name associated with this error (optional) plugin: The plugin name associated with this error (optional)
user_id: The user ID associated with this error (optional)
""" """
import InvenTree.ready import InvenTree.ready
@ -71,6 +73,9 @@ def log_error(
except AttributeError: except AttributeError:
data = 'No traceback information available' data = 'No traceback information available'
if user_id:
data = f'User ID: {user_id}\n{data}'
# Log error to stderr # Log error to stderr
logger.error(info) logger.error(info)

View File

@ -1,6 +1,7 @@
"""Custom fields used in InvenTree.""" """Custom fields used in InvenTree."""
import sys import sys
import uuid
from decimal import Decimal from decimal import Decimal
from django import forms from django import forms
@ -59,6 +60,34 @@ class InvenTreeURLField(models.URLField):
super().__init__(**kwargs) super().__init__(**kwargs)
class InvenTreeUUIDField(models.UUIDField):
"""UUIDField which is always stored as a char(32) column on MySQL / MariaDB.
On MariaDB 10.7+, Django maps UUIDField to the native 'uuid' column type,
and writes 36-character (hyphenated) values to match.
However, databases migrated under older Django / MariaDB versions retain
their original char(32) columns, into which a 36-character value does not fit.
To ensure consistent behavior across all supported database backends,
we force the legacy char(32) storage format on MySQL / MariaDB.
Ref: https://docs.djangoproject.com/en/5.2/releases/5.0/#migrating-existing-uuidfield-on-mariadb-10-7
"""
def db_type(self, connection):
"""Force a char(32) column type on MySQL / MariaDB backends."""
if connection.vendor == 'mysql':
return 'char(32)'
return super().db_type(connection)
def get_db_prep_value(self, value, connection, prepared=False):
"""Store values in 32-character hex format on MySQL / MariaDB backends."""
value = super().get_db_prep_value(value, connection, prepared)
if connection.vendor == 'mysql' and isinstance(value, uuid.UUID):
value = value.hex
return value
def money_kwargs(**kwargs): def money_kwargs(**kwargs):
"""Returns the database settings for MoneyFields.""" """Returns the database settings for MoneyFields."""
from common.currency import currency_code_mappings from common.currency import currency_code_mappings
@ -71,7 +100,9 @@ def money_kwargs(**kwargs):
kwargs['decimal_places'] = 6 kwargs['decimal_places'] = 6
if 'currency_choices' not in kwargs: if 'currency_choices' not in kwargs:
kwargs['currency_choices'] = currency_code_mappings() # Pass the function itself (not the evaluated result) so that the
# available currency options are resolved dynamically.
kwargs['currency_choices'] = currency_code_mappings
if InvenTree.ready.isRunningMigrations(): if InvenTree.ready.isRunningMigrations():
# During migrations, avoid setting a default currency # During migrations, avoid setting a default currency

View File

@ -1465,11 +1465,15 @@ def after_failed_task(sender, instance: Task, created: bool, **kwargs):
# Create a new Error object associated with this failed task # Create a new Error object associated with this failed task
# This will, in turn, trigger a notification to staff users via the Error post_save signal # This will, in turn, trigger a notification to staff users via the Error post_save signal
message = f"Task '{instance.func} ({instance.pk})' failed after {n} attempts"
logger.error(message)
log_error( log_error(
'task_failure', 'task_failure',
scope='worker', scope='worker',
error_name='Task Failure', error_name='Task Failure',
error_info=f"Task '{instance.pk}' failed after {n} attempts", error_info=message,
error_data=str(instance.result) if instance.result else '', error_data=str(instance.result) if instance.result else '',
) )

View File

@ -16,6 +16,7 @@ from drf_spectacular.utils import (
extend_schema, extend_schema,
extend_schema_view, extend_schema_view,
) )
from rest_framework import serializers
from rest_framework.pagination import LimitOffsetPagination from rest_framework.pagination import LimitOffsetPagination
from InvenTree.permissions import OASTokenMixin from InvenTree.permissions import OASTokenMixin
@ -46,6 +47,20 @@ class ExtendedOAuth2Scheme(DjangoOAuthToolkitScheme):
class ExtendedAutoSchema(AutoSchema): class ExtendedAutoSchema(AutoSchema):
"""Extend drf-spectacular to allow customizing the schema to match the actual API behavior.""" """Extend drf-spectacular to allow customizing the schema to match the actual API behavior."""
def _map_serializer_field(self, field, direction, *args, **kwargs):
"""Custom field mapping overrides, falling back to default behavior."""
schema = super()._map_serializer_field(field, direction, *args, **kwargs)
direction_value = getattr(direction, 'value', direction)
# File and image fields in request schemas must be represented as binary
# payloads. In response schemas they are still rendered as URLs.
if direction_value == 'request' and isinstance(field, serializers.FileField):
schema['type'] = 'string'
schema['format'] = 'binary'
return schema
def is_bulk_action(self, ref: str) -> bool: def is_bulk_action(self, ref: str) -> bool:
"""Check the class of the current view for the bulk mixins.""" """Check the class of the current view for the bulk mixins."""
return ref in [c.__name__ for c in type(self.view).__mro__] return ref in [c.__name__ for c in type(self.view).__mro__]

View File

@ -600,7 +600,7 @@ class InvenTreeModelSerializer(serializers.ModelSerializer):
Default implementation returns an empty list Default implementation returns an empty list
""" """
return [] return getattr(self, 'SKIP_CREATE_FIELDS', [])
def save(self, **kwargs): def save(self, **kwargs):
"""Catch any django ValidationError thrown at the moment `save` is called, and re-throw as a DRF ValidationError.""" """Catch any django ValidationError thrown at the moment `save` is called, and re-throw as a DRF ValidationError."""
@ -822,9 +822,13 @@ class NotesFieldMixin:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
if hasattr(self, 'context'): if hasattr(self, 'context'):
request = self.context.get('request', None)
method = getattr(request, 'method', None)
if view := self.context.get('view', None): if view := self.context.get('view', None):
if ( if (
issubclass(view.__class__, ListModelMixin) issubclass(view.__class__, ListModelMixin)
and method in SAFE_METHODS
and not InvenTree.ready.isGeneratingSchema() and not InvenTree.ready.isGeneratingSchema()
): ):
self.fields.pop('notes', None) self.fields.pop('notes', None)
@ -921,3 +925,104 @@ class ContentTypeField(serializers.ChoiceField):
) )
return content_type return content_type
class DuplicateOptionsSerializer(serializers.Serializer):
"""Generic serializer for specifying copy options when duplicating a model instance.
Builds its fields dynamically at instantiation time so the same class can be
reused for any model without subclassing.
"""
# Special 'shortcut' fields which are used for multiple models
DEFAULT_FIELDS = [
(
'copy_parameters',
_('Copy Parameters'),
_('Copy parameters from the original item'),
False,
),
(
'copy_lines',
_('Copy Lines'),
_('Copy line items from the original order'),
False,
),
(
'copy_extra_lines',
_('Copy Extra Lines'),
_('Copy extra line items from the original order'),
False,
),
]
def __init__(
self,
queryset: QuerySet,
*args,
copy_fields: Optional[list[dict]] = None,
**kwargs,
):
"""Initialise the serializer and dynamically attach fields.
Arguments:
queryset: Queryset used for the `original` PrimaryKeyRelatedField.
copy_fields: Optional list of dicts, each describing one boolean copy toggle.
Keys:
name: (str, required)
label: (str, optional)
help_text: (str, optional)
default: (bool, optional, default True)
"""
# Enforce certain properties onto this serializer
kwargs['label'] = kwargs.get('label', _('Duplication Options'))
kwargs['help_text'] = kwargs.get(
'help_text', _('Specify options for duplicating this item')
)
kwargs['required'] = False
kwargs['write_only'] = True
copy_fields = copy_fields or []
copy_field_names = [spec['name'] for spec in copy_fields]
# Apply "default" fields
for name, label, help_text, default_value in self.DEFAULT_FIELDS:
popped_value = kwargs.pop(name, default_value)
if name in copy_field_names:
# Manually supplied field, continue
continue
if popped_value:
copy_fields.append({
'name': name,
'label': label,
'help_text': help_text,
'default': True,
})
super().__init__(*args, **kwargs)
# Re-class the instance with a model-specific subclass,
# so that each model generates a unique schema component name
if self.__class__ is DuplicateOptionsSerializer:
self.__class__ = type(
f'{queryset.model.__name__}DuplicateOptionsSerializer',
(DuplicateOptionsSerializer,),
{},
)
self.fields['original'] = serializers.PrimaryKeyRelatedField(
queryset=queryset,
required=True,
label=_('Original'),
help_text=_('Select instance to duplicate'),
)
for spec in copy_fields or []:
self.fields[spec['name']] = serializers.BooleanField(
required=False,
default=spec.get('default', True),
label=spec.get('label', spec['name']),
help_text=spec.get('help_text', ''),
)

View File

@ -1,5 +1,7 @@
"""Tests for custom InvenTree management commands.""" """Tests for custom InvenTree management commands."""
import os
import subprocess
from pathlib import Path from pathlib import Path
from django.conf import settings from django.conf import settings
@ -15,6 +17,48 @@ from InvenTree.config import get_testfolder_dir
class CommandTestCase(TestCase): class CommandTestCase(TestCase):
"""Test case for custom management commands.""" """Test case for custom management commands."""
def test_makemigrations_currency_overrides_no_changes(self):
"""Ensure currency list changes do not cause migration drift."""
currency_sets = ['USD,EUR,GBP', 'JPY,CNY,KRW']
for currency_codes in currency_sets:
with self.subTest(currency_codes=currency_codes):
old_value = os.environ.get('INVENTREE_CURRENCY_CODES')
try:
os.environ['INVENTREE_CURRENCY_CODES'] = currency_codes
project_dir = Path(__file__).resolve().parents[1]
result = subprocess.run(
[
'python3',
'manage.py',
'makemigrations',
'--check',
'--dry-run',
'--verbosity',
'0',
],
cwd=project_dir,
env=os.environ.copy(),
capture_output=True,
text=True,
check=False,
)
if result.returncode != 0:
self.fail(
'makemigrations reported schema changes '
f'for INVENTREE_CURRENCY_CODES={currency_codes}\n'
f'stdout:\n{result.stdout}\n'
f'stderr:\n{result.stderr}'
)
finally:
if old_value is None:
os.environ.pop('INVENTREE_CURRENCY_CODES', None)
else:
os.environ['INVENTREE_CURRENCY_CODES'] = old_value
def test_schema(self): def test_schema(self):
"""Test the schema generation command.""" """Test the schema generation command."""
output = call_command('schema', file='schema.yml', verbosity=0) output = call_command('schema', file='schema.yml', verbosity=0)

View File

@ -22,6 +22,7 @@ from djmoney.contrib.exchange.exceptions import MissingRate
from djmoney.contrib.exchange.models import Rate, convert_money from djmoney.contrib.exchange.models import Rate, convert_money
from djmoney.money import Money from djmoney.money import Money
from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode
from rest_framework import serializers
from sesame.utils import get_user from sesame.utils import get_user
from stdimage.models import StdImageFieldFile from stdimage.models import StdImageFieldFile
@ -1817,6 +1818,35 @@ class SchemaPostprocessingTest(TestCase):
# required key removed when empty # required key removed when empty
self.assertNotIn('required', schemas_out.get('SalesOrderShipment')) self.assertNotIn('required', schemas_out.get('SalesOrderShipment'))
def test_file_field_request_schema_binary(self):
"""Verify only request file fields are exposed as binary."""
auto_schema = object.__new__(schema.ExtendedAutoSchema)
mapped_schemas = [
{'type': 'string', 'format': 'uri', 'nullable': True},
{'type': 'string', 'format': 'uri'},
{'type': 'string', 'format': 'uri', 'nullable': True},
]
with mock.patch(
'drf_spectacular.openapi.AutoSchema._map_serializer_field',
side_effect=mapped_schemas,
):
file_request = auto_schema._map_serializer_field(
serializers.FileField(allow_null=True), 'request'
)
url_request = auto_schema._map_serializer_field(
serializers.URLField(), 'request'
)
file_response = auto_schema._map_serializer_field(
serializers.FileField(allow_null=True), 'response'
)
self.assertEqual(file_request['format'], 'binary')
self.assertTrue(file_request['nullable'])
self.assertEqual(url_request['format'], 'uri')
self.assertEqual(file_response['format'], 'uri')
class URLCompatibilityTest(InvenTreeTestCase): class URLCompatibilityTest(InvenTreeTestCase):
"""Unit test for legacy URL compatibility.""" """Unit test for legacy URL compatibility."""

View File

@ -15,10 +15,10 @@ from datetime import timedelta as td
from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION
# InvenTree software version # InvenTree software version
INVENTREE_SW_VERSION = '1.4.0' INVENTREE_SW_VERSION = '1.5.0 dev'
# Minimum supported Python version # Minimum supported Python version
MIN_PYTHON_VERSION = (3, 11) MIN_PYTHON_VERSION = (3, 12)
logger = logging.getLogger('inventree') logger = logging.getLogger('inventree')
@ -133,27 +133,14 @@ def isInvenTreeDevelopmentVersion() -> bool:
return inventreeVersion().endswith('dev') return inventreeVersion().endswith('dev')
def inventreeDocsVersion() -> str:
"""Return the version string matching the latest documentation.
Development -> "latest"
Release -> "major.minor.sub" e.g. "0.5.2"
"""
if isInvenTreeDevelopmentVersion():
return 'latest'
return INVENTREE_SW_VERSION
def inventreeDocUrl() -> str: def inventreeDocUrl() -> str:
"""Return URL for InvenTree documentation site.""" """Return URL for InvenTree documentation site."""
tag = inventreeDocsVersion() return 'https://docs.inventree.org'
return f'https://docs.inventree.org/en/{tag}'
def inventreeAppUrl() -> str: def inventreeAppUrl() -> str:
"""Return URL for InvenTree app site.""" """Return URL for InvenTree app site."""
return 'https://docs.inventree.org/en/stable/app/' return 'https://docs.inventree.org/en/latest/app/'
def inventreeGithubUrl() -> str: def inventreeGithubUrl() -> str:

View File

@ -457,8 +457,21 @@ class BuildLineFilter(FilterSet):
# Fields on related models # Fields on related models
consumable = rest_filters.BooleanFilter( consumable = rest_filters.BooleanFilter(
label=_('Consumable'), field_name='bom_item__consumable' label=_('Consumable'), method='filter_consumable'
) )
def filter_consumable(self, queryset, name, value):
"""Filter the queryset based on the "effective" consumable status of the BOM item.
A BuildLine is considered "consumable" if either the BOM item itself,
or the underlying part, is marked as consumable.
"""
return queryset.filter(
part_models.BomItem.consumable_filter(
consumable=str2bool(value), prefix='bom_item__'
)
)
optional = rest_filters.BooleanFilter( optional = rest_filters.BooleanFilter(
label=_('Optional'), field_name='bom_item__optional' label=_('Optional'), field_name='bom_item__optional'
) )

View File

@ -37,10 +37,7 @@ from build.validators import (
validate_build_order_reference, validate_build_order_reference,
) )
from common.models import ProjectCode from common.models import ProjectCode
from common.settings import ( from common.settings import get_global_setting
get_global_setting,
prevent_build_output_complete_on_incompleted_tests,
)
from generic.enums import StringEnum from generic.enums import StringEnum
from generic.states import StateTransitionMixin, StatusCodeMixin from generic.states import StateTransitionMixin, StatusCodeMixin
from plugin.events import trigger_event from plugin.events import trigger_event
@ -977,7 +974,9 @@ class Build(
items_to_delete = [] items_to_delete = []
lines = self.untracked_line_items.all() lines = self.untracked_line_items.all()
lines = lines.exclude(bom_item__consumable=True) lines = lines.exclude(
part.models.BomItem.consumable_filter(prefix='bom_item__')
)
lines = lines.annotate(allocated=annotate_allocated_quantity()) lines = lines.annotate(allocated=annotate_allocated_quantity())
for build_line in lines: for build_line in lines:
@ -1093,6 +1092,61 @@ class Build(
}, },
) )
def can_complete_output(
self,
output: stock.models.StockItem,
quantity: Optional[decimal.Decimal] = None,
required_tests=None,
) -> bool:
"""Determine if the given build output can be completed.
Arguments:
output: The StockItem instance (build output) to check
quantity: The quantity to complete (defaults to entire output quantity)
required_tests: Optional list of required tests to check against (defaults to the part's required tests)
Returns:
True if the build output can be completed, False otherwise
Raises:
ValidationError: If the build output cannot be completed, with an appropriate message
"""
prevent_incomplete = get_global_setting(
'PREVENT_BUILD_COMPLETION_HAVING_INCOMPLETED_TESTS'
)
if prevent_incomplete and not output.passedAllRequiredTests(
required_tests=required_tests
):
raise ValidationError(_('Build output has not passed all required tests'))
# Ensure that none of the allocated items are themselves still "in production"
allocated_items = output.items_to_install.all().filter(
stock_item__is_building=True
)
if allocated_items.exists():
raise ValidationError(_('Allocated stock items are still in production'))
if quantity is not None and quantity != output.quantity:
# Cannot split a build output with allocated items
if output.items_to_install.exists():
raise ValidationError({
'quantity': _(
'Cannot partially complete a build output with allocated items'
)
})
if quantity <= 0:
raise ValidationError({
'quantity': _('Quantity must be greater than zero')
})
if quantity > output.quantity:
raise ValidationError({
'quantity': _('Quantity cannot be greater than the output quantity')
})
@transaction.atomic @transaction.atomic
def complete_build_output( def complete_build_output(
self, self,
@ -1118,52 +1172,20 @@ class Build(
notes = kwargs.get('notes', '') notes = kwargs.get('notes', '')
required_tests = kwargs.get('required_tests', output.part.getRequiredTests()) required_tests = kwargs.get('required_tests', output.part.getRequiredTests())
prevent_on_incomplete = kwargs.get(
'prevent_on_incomplete',
prevent_build_output_complete_on_incompleted_tests(),
)
if prevent_on_incomplete and not output.passedAllRequiredTests( self.can_complete_output(
required_tests=required_tests output, quantity=quantity, required_tests=required_tests
):
msg = _('Build output has not passed all required tests')
if serial := output.serial:
msg = _(f'Build output {serial} has not passed all required tests')
raise ValidationError(msg)
# List the allocated BuildItem objects for the given output
allocated_items = output.items_to_install.all()
# Ensure that none of the allocated items are themselves still "in production"
for build_item in allocated_items:
if build_item.stock_item.is_building:
raise ValidationError(
_('Allocated stock items are still in production')
) )
# If a partial quantity is provided, split the stock output # If a partial quantity is provided, split the stock output
if quantity is not None and quantity != output.quantity: if quantity is not None and quantity != output.quantity:
# Cannot split a build output with allocated items
if allocated_items.count() > 0:
raise ValidationError(
_('Cannot partially complete a build output with allocated items')
)
if quantity <= 0:
raise ValidationError({
'quantity': _('Quantity must be greater than zero')
})
if quantity > output.quantity:
raise ValidationError({
'quantity': _('Quantity cannot be greater than the output quantity')
})
# Split the stock item # Split the stock item
output = output.splitStock(quantity, user=user, allow_production=True) output = output.splitStock(quantity, user=user, allow_production=True)
allocated_items = output.items_to_install.all().select_related(
'stock_item', 'stock_item__part'
)
for build_item in allocated_items: for build_item in allocated_items:
# Complete the allocation of stock for that item # Complete the allocation of stock for that item
build_item.complete_allocation(user=user) build_item.complete_allocation(user=user)
@ -1234,13 +1256,16 @@ class Build(
return allocations return allocations
tracked_line_items = self.tracked_line_items.filter( tracked_line_items = self.tracked_line_items.filter(
bom_item__consumable=False, bom_item__sub_part__virtual=False part.models.BomItem.consumable_filter(
consumable=False, prefix='bom_item__'
),
bom_item__sub_part__virtual=False,
) )
for line_item in tracked_line_items: for line_item in tracked_line_items:
bom_item = line_item.bom_item bom_item = line_item.bom_item
if bom_item.consumable: if bom_item.is_consumable:
# Do not auto-allocate stock to consumable BOM items # Do not auto-allocate stock to consumable BOM items
continue continue
@ -1364,7 +1389,7 @@ class Build(
# Find the referenced BomItem # Find the referenced BomItem
bom_item = line_item.bom_item bom_item = line_item.bom_item
if bom_item.consumable: if bom_item.is_consumable:
# Do not auto-allocate stock to consumable BOM items # Do not auto-allocate stock to consumable BOM items
continue continue
@ -1484,7 +1509,9 @@ class Build(
lines = self.build_lines.all() lines = self.build_lines.all()
# Remove any 'consumable' line items # Remove any 'consumable' line items
lines = lines.exclude(bom_item__consumable=True) lines = lines.exclude(
part.models.BomItem.consumable_filter(prefix='bom_item__')
)
if tracked is True: if tracked is True:
lines = lines.filter(bom_item__sub_part__trackable=True) lines = lines.filter(bom_item__sub_part__trackable=True)
@ -1521,7 +1548,9 @@ class Build(
we need to test all "trackable" BuildLine objects we need to test all "trackable" BuildLine objects
""" """
lines = self.build_lines.filter(bom_item__sub_part__trackable=True) lines = self.build_lines.filter(bom_item__sub_part__trackable=True)
lines = lines.exclude(bom_item__consumable=True) lines = lines.exclude(
part.models.BomItem.consumable_filter(prefix='bom_item__')
)
# Find any lines which have not been fully allocated # Find any lines which have not been fully allocated
for line in lines: for line in lines:
@ -1545,7 +1574,9 @@ class Build(
Returns: Returns:
True if any BuildLine has been over-allocated. True if any BuildLine has been over-allocated.
""" """
lines = self.build_lines.all().exclude(bom_item__consumable=True) lines = self.build_lines.all().exclude(
part.models.BomItem.consumable_filter(prefix='bom_item__')
)
lines = lines.prefetch_related('allocations') lines = lines.prefetch_related('allocations')
@ -1774,7 +1805,7 @@ class BuildLine(report.mixins.InvenTreeReportMixin, InvenTree.models.InvenTreeMo
def is_fully_allocated(self) -> bool: def is_fully_allocated(self) -> bool:
"""Return True if this BuildLine is fully allocated.""" """Return True if this BuildLine is fully allocated."""
if self.bom_item.consumable: if self.bom_item.is_consumable:
return True return True
required = max(0, self.quantity - self.consumed) required = max(0, self.quantity - self.consumed)

View File

@ -1,6 +1,8 @@
"""JSON serializers for Build API.""" """JSON serializers for Build API."""
from collections.abc import Callable
from decimal import Decimal from decimal import Decimal
from typing import Optional
from django.core.exceptions import ValidationError as DjangoValidationError from django.core.exceptions import ValidationError as DjangoValidationError
from django.db import models, transaction from django.db import models, transaction
@ -22,7 +24,6 @@ from rest_framework import serializers
from rest_framework.serializers import ValidationError from rest_framework.serializers import ValidationError
import common.filters import common.filters
import common.settings
import company.serializers import company.serializers
import InvenTree.helpers import InvenTree.helpers
import part.filters import part.filters
@ -33,6 +34,7 @@ from generic.states.fields import InvenTreeCustomStatusSerializerMixin
from InvenTree.mixins import DataImportExportSerializerMixin from InvenTree.mixins import DataImportExportSerializerMixin
from InvenTree.serializers import ( from InvenTree.serializers import (
CustomStatusSerializerMixin, CustomStatusSerializerMixin,
DuplicateOptionsSerializer,
FilterableSerializerMixin, FilterableSerializerMixin,
InvenTreeDecimalField, InvenTreeDecimalField,
InvenTreeModelSerializer, InvenTreeModelSerializer,
@ -52,6 +54,7 @@ from users.serializers import OwnerSerializer, UserSerializer
from .models import Build, BuildItem, BuildLine from .models import Build, BuildItem, BuildLine
from .status_codes import BuildStatus from .status_codes import BuildStatus
from .validators import check_build_output
class BuildSerializer( class BuildSerializer(
@ -65,6 +68,8 @@ class BuildSerializer(
): ):
"""Serializes a Build object.""" """Serializes a Build object."""
SKIP_CREATE_FIELDS = ['duplicate']
class Meta: class Meta:
"""Serializer metaclass.""" """Serializer metaclass."""
@ -78,6 +83,7 @@ class BuildSerializer(
'completed', 'completed',
'completion_date', 'completion_date',
'destination', 'destination',
'duplicate',
'external', 'external',
'parent', 'parent',
'part', 'part',
@ -188,12 +194,29 @@ class BuildSerializer(
return queryset return queryset
duplicate = DuplicateOptionsSerializer(Build.objects.all(), copy_parameters=True)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Determine if extra serializer fields are required.""" """Determine if extra serializer fields are required."""
kwargs.pop('create', False) kwargs.pop('create', False)
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@transaction.atomic
def create(self, validated_data):
"""Create a new Build instance, optionally copying data from an existing build."""
duplicate = validated_data.pop('duplicate', None)
instance = super().create(validated_data)
if duplicate:
original = duplicate['original']
if duplicate.get('copy_parameters', True):
instance.copy_parameters_from(original)
return instance
def validate_reference(self, reference): def validate_reference(self, reference):
"""Custom validation for the Build reference field.""" """Custom validation for the Build reference field."""
# Ensure the reference matches the required pattern # Ensure the reference matches the required pattern
@ -260,11 +283,19 @@ class BuildOutputSerializer(serializers.Serializer):
class BuildOutputQuantitySerializer(BuildOutputSerializer): class BuildOutputQuantitySerializer(BuildOutputSerializer):
"""Build output with quantity field.""" """Build output with quantity field."""
# Optional callable to validate the output field, if required
output_validator: Optional[Callable] = None
class Meta: class Meta:
"""Serializer metaclass.""" """Serializer metaclass."""
fields = [*BuildOutputSerializer.Meta.fields, 'quantity'] fields = [*BuildOutputSerializer.Meta.fields, 'quantity']
def __init__(self, *args, **kwargs):
"""Initialize the serializer."""
self.output_validator = kwargs.pop('output_validator', None)
super().__init__(*args, **kwargs)
quantity = serializers.DecimalField( quantity = serializers.DecimalField(
max_digits=15, max_digits=15,
decimal_places=5, decimal_places=5,
@ -292,6 +323,10 @@ class BuildOutputQuantitySerializer(BuildOutputSerializer):
'quantity': _('Quantity cannot be greater than the output quantity') 'quantity': _('Quantity cannot be greater than the output quantity')
}) })
if self.output_validator:
# Call the parent serializer's output validator, if provided
self.output_validator(output, quantity=quantity)
return data return data
@ -527,7 +562,9 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
'notes', 'notes',
] ]
outputs = BuildOutputQuantitySerializer(many=True, required=True) outputs = BuildOutputQuantitySerializer(
many=True, required=True, output_validator=check_build_output
)
location = serializers.PrimaryKeyRelatedField( location = serializers.PrimaryKeyRelatedField(
queryset=StockLocation.objects.all(), queryset=StockLocation.objects.all(),
@ -554,30 +591,6 @@ class BuildOutputCompleteSerializer(serializers.Serializer):
outputs = data.get('outputs', []) outputs = data.get('outputs', [])
if common.settings.prevent_build_output_complete_on_incompleted_tests():
errors = []
for output in outputs:
stock_item = output['output']
if (
stock_item.hasRequiredTests()
and not stock_item.passedAllRequiredTests()
):
serial = stock_item.serial
if serial:
errors.append(
_(
f'Build output {serial} has not passed all required tests'
)
)
else:
errors.append(
_('Build output has not passed all required tests')
)
if errors:
raise ValidationError(errors)
if len(outputs) == 0: if len(outputs) == 0:
raise ValidationError(_('A list of build outputs must be provided')) raise ValidationError(_('A list of build outputs must be provided'))
@ -983,7 +996,7 @@ class BuildAllocationSerializer(serializers.Serializer):
output = item.get('output', None) output = item.get('output', None)
# Ignore allocation for consumable BOM items # Ignore allocation for consumable BOM items
if build_line.bom_item.consumable: if build_line.bom_item.is_consumable:
continue continue
params = { params = {
@ -1376,7 +1389,7 @@ class BuildLineSerializer(
source='bom_item.reference', label=_('Reference'), read_only=True source='bom_item.reference', label=_('Reference'), read_only=True
) )
consumable = serializers.BooleanField( consumable = serializers.BooleanField(
source='bom_item.consumable', label=_('Consumable'), read_only=True source='bom_item.is_consumable', label=_('Consumable'), read_only=True
) )
optional = serializers.BooleanField( optional = serializers.BooleanField(
source='bom_item.optional', label=_('Optional'), read_only=True source='bom_item.optional', label=_('Optional'), read_only=True

View File

@ -11,7 +11,7 @@ from build.models import Build, BuildItem, BuildLine
from build.status_codes import BuildStatus from build.status_codes import BuildStatus
from common.settings import set_global_setting from common.settings import set_global_setting
from InvenTree.unit_test import InvenTreeAPITestCase from InvenTree.unit_test import InvenTreeAPITestCase
from part.models import BomItem, BomItemSubstitute, Part from part.models import BomItem, BomItemSubstitute, Part, PartTestTemplate
from stock.models import StockItem, StockLocation, StockSortOrder from stock.models import StockItem, StockLocation, StockSortOrder
from stock.status_codes import StockStatus from stock.status_codes import StockStatus
@ -1531,10 +1531,15 @@ class BuildOutputScrapTest(BuildAPITest):
'notes': 'Partial complete', 'notes': 'Partial complete',
} }
# Ensure that an invalid quantity raises an error # Ensure that an invalid quantity raises an error, with the expected message
for q in [-4, 0, 999]: for q, expected_message in [
(-4, 'Ensure this value is greater than or equal to 0'),
(0, 'Quantity must be greater than zero'),
(999, 'Quantity cannot be greater than the output quantity'),
]:
data['outputs'][0]['quantity'] = q data['outputs'][0]['quantity'] = q
self.post(url, data, expected_code=400) response = self.post(url, data, expected_code=400)
self.assertIn(expected_message, str(response.data))
# Partially complete the output (with a valid quantity) # Partially complete the output (with a valid quantity)
data['outputs'][0]['quantity'] = 4 data['outputs'][0]['quantity'] = 4
@ -1552,6 +1557,94 @@ class BuildOutputScrapTest(BuildAPITest):
self.assertEqual(completed_output.status, StockStatus.OK) self.assertEqual(completed_output.status, StockStatus.OK)
self.assertFalse(completed_output.is_building) self.assertFalse(completed_output.is_building)
def test_complete_with_required_tests(self):
"""Test that build output completion is blocked if required tests have not passed."""
build = Build.objects.get(pk=1)
output = build.create_build_output(1).first()
template = PartTestTemplate.objects.create(
part=build.part, test_name='Required test', required=True
)
set_global_setting(
'PREVENT_BUILD_COMPLETION_HAVING_INCOMPLETED_TESTS', True, change_user=None
)
url = reverse('api-build-output-complete', kwargs={'pk': build.pk})
data = {'outputs': [{'output': output.pk}], 'location': 1}
response = self.post(url, data, expected_code=400)
self.assertIn(
'Build output has not passed all required tests', str(response.data)
)
# Add a passing test result - the output should now be able to be completed
output.add_test_result(template=template, result=True)
self.post(url, data, expected_code=200)
def test_complete_still_in_production(self):
"""Test that build output completion is blocked if an allocated item is still in production."""
build = Build.objects.get(pk=1)
output = build.create_build_output(1).first()
build.create_build_line_items()
line = build.build_lines.first()
sub_build = Build.objects.create(
part=line.bom_item.sub_part,
quantity=1,
title='Sub-build',
reference='BO-9998',
)
in_production = StockItem.objects.create(
part=line.bom_item.sub_part, quantity=1, is_building=True, build=sub_build
)
BuildItem.objects.create(
build_line=line, stock_item=in_production, quantity=1, install_into=output
)
url = reverse('api-build-output-complete', kwargs={'pk': build.pk})
response = self.post(
url, {'outputs': [{'output': output.pk}], 'location': 1}, expected_code=400
)
self.assertIn(
'Allocated stock items are still in production', str(response.data)
)
def test_partial_complete_with_allocated_items(self):
"""Test that a build output with allocated items cannot be partially completed."""
build = Build.objects.get(pk=1)
output = build.create_build_output(10).first()
build.create_build_line_items()
line = build.build_lines.first()
stock_item = StockItem.objects.create(part=line.bom_item.sub_part, quantity=10)
BuildItem.objects.create(
build_line=line, stock_item=stock_item, quantity=1, install_into=output
)
url = reverse('api-build-output-complete', kwargs={'pk': build.pk})
response = self.post(
url,
{'outputs': [{'output': output.pk, 'quantity': 4}], 'location': 1},
expected_code=400,
)
self.assertIn(
'Cannot partially complete a build output with allocated items',
str(response.data),
)
class BuildOutputCancelTest(BuildAPITest): class BuildOutputCancelTest(BuildAPITest):
"""Test cancellation of build outputs.""" """Test cancellation of build outputs."""
@ -1794,6 +1887,77 @@ class BuildLineTests(BuildAPITest):
self.assertSetEqual(false_ids, expected_false) self.assertSetEqual(false_ids, expected_false)
self.assertSetEqual(true_ids | false_ids, {line.pk for line in lines}) self.assertSetEqual(true_ids | false_ids, {line.pk for line in lines})
def test_filter_consumable_via_part(self):
"""Filter BuildLine objects by 'consumable' status, accounting for the underlying part.
A BuildLine should be treated as 'consumable' if either the BOM line
itself is marked as consumable, or the underlying part is marked as consumable.
"""
assembly = Part.objects.create(
name='Consumable Filter Assembly',
description='Assembly for consumable filter tests',
assembly=True,
)
plain = Part.objects.create(
name='Consumable Filter Plain Component',
description='A regular component',
component=True,
)
consumable_part = Part.objects.create(
name='Consumable Filter Consumable Part',
description='A part marked as consumable',
component=True,
consumable=True,
)
consumable_line_part = Part.objects.create(
name='Consumable Filter Consumable BOM Line',
description='A part which is consumable only via its BOM line',
component=True,
)
bom_item_plain = BomItem.objects.create(
part=assembly, sub_part=plain, quantity=1
)
bom_item_part_consumable = BomItem.objects.create(
part=assembly, sub_part=consumable_part, quantity=1
)
bom_item_line_consumable = BomItem.objects.create(
part=assembly, sub_part=consumable_line_part, quantity=1, consumable=True
)
build = Build.objects.create(
part=assembly,
reference='BO-9997',
quantity=1,
title='Consumable Filter Build',
)
url = reverse('api-build-line-list')
response = self.get(url, data={'build': build.pk, 'consumable': True})
returned_bom_items = {item['bom_item'] for item in response.data}
self.assertIn(bom_item_part_consumable.pk, returned_bom_items)
self.assertIn(bom_item_line_consumable.pk, returned_bom_items)
self.assertNotIn(bom_item_plain.pk, returned_bom_items)
response = self.get(url, data={'build': build.pk, 'consumable': False})
returned_bom_items = {item['bom_item'] for item in response.data}
self.assertIn(bom_item_plain.pk, returned_bom_items)
self.assertNotIn(bom_item_part_consumable.pk, returned_bom_items)
self.assertNotIn(bom_item_line_consumable.pk, returned_bom_items)
# Check that the serialized 'consumable' field reflects the combined status
response = self.get(
url, data={'build': build.pk, 'bom_item': bom_item_part_consumable.pk}
)
self.assertEqual(len(response.data), 1)
self.assertTrue(response.data[0]['consumable'])
def test_output_options(self): def test_output_options(self):
"""Test output options for the BuildLine endpoint.""" """Test output options for the BuildLine endpoint."""
self.run_output_test( self.run_output_test(

View File

@ -650,11 +650,15 @@ class BuildTest(BuildTestBase):
'PREVENT_BUILD_COMPLETION_HAVING_INCOMPLETED_TESTS', True, change_user=None 'PREVENT_BUILD_COMPLETION_HAVING_INCOMPLETED_TESTS', True, change_user=None
) )
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError) as exc:
self.build_w_tests_trackable.complete_build_output( self.build_w_tests_trackable.complete_build_output(
self.stockitem_with_required_test, None self.stockitem_with_required_test, None
) )
self.assertIn(
'Build output has not passed all required tests', str(exc.exception)
)
# let's complete the required test and see if it could be saved # let's complete the required test and see if it could be saved
StockItemTestResult.objects.create( StockItemTestResult.objects.create(
stock_item=self.stockitem_with_required_test, stock_item=self.stockitem_with_required_test,
@ -671,6 +675,59 @@ class BuildTest(BuildTestBase):
self.stockitem_wo_required_test, None self.stockitem_wo_required_test, None
) )
def test_complete_output_still_in_production(self):
"""Test that a build output cannot be completed if allocated stock is still in production."""
# Create a stock item of the tracked sub-part, which is itself still "in production"
sub_build = Build.objects.create(
reference=generate_next_build_reference(),
title='Building a sub-part',
part=self.sub_part_3,
quantity=2,
issued_by=get_user_model().objects.get(pk=1),
)
in_production = StockItem.objects.create(
part=self.sub_part_3, quantity=2, is_building=True, build=sub_build
)
self.allocate_stock(self.output_1, {in_production: 2})
with self.assertRaises(ValidationError) as exc:
self.build.complete_build_output(self.output_1, None)
self.assertIn(
'Allocated stock items are still in production', str(exc.exception)
)
def test_partial_complete_with_allocated_items(self):
"""Test that a build output with tracked allocations cannot be partially completed."""
# Allocate tracked stock against output_1 (quantity=3)
self.allocate_stock(self.output_1, {self.stock_3_1: 6})
with self.assertRaises(ValidationError) as exc:
self.build.complete_build_output(self.output_1, None, quantity=1)
self.assertIn(
'Cannot partially complete a build output with allocated items',
str(exc.exception),
)
def test_complete_output_invalid_quantity(self):
"""Test that invalid quantities are rejected when completing a build output directly."""
with self.assertRaises(ValidationError) as exc:
self.build.complete_build_output(self.output_1, None, quantity=0)
self.assertIn('Quantity must be greater than zero', str(exc.exception))
with self.assertRaises(ValidationError) as exc:
self.build.complete_build_output(
self.output_1, None, quantity=self.output_1.quantity + 1
)
self.assertIn(
'Quantity cannot be greater than the output quantity', str(exc.exception)
)
def test_overdue_notification(self): def test_overdue_notification(self):
"""Test sending of notifications when a build order is overdue.""" """Test sending of notifications when a build order is overdue."""
self.ensurePluginsLoaded() self.ensurePluginsLoaded()
@ -941,6 +998,38 @@ class AutoAllocationTests(BuildTestBase):
self.assertEqual(self.build.allocated_stock.count(), N - 8) self.assertEqual(self.build.allocated_stock.count(), N - 8)
def test_consumable_via_part(self):
"""A BOM line should be treated as consumable if the underlying part is consumable.
Even though 'bom_item_1' itself is not marked as consumable, marking
'sub_part_1' as consumable should have the same effect as marking the
BOM line itself as consumable.
"""
self.sub_part_1.consumable = True
self.sub_part_1.save()
self.assertFalse(self.bom_item_1.consumable)
self.assertTrue(self.bom_item_1.is_consumable)
# The BuildLine should be treated as fully allocated, without any stock allocated
self.assertEqual(self.line_1.allocated_quantity(), 0)
self.assertTrue(self.line_1.is_fully_allocated())
# The build should not consider this line when checking for unallocated lines
unallocated_lines = self.build.unallocated_lines(tracked=False)
self.assertNotIn(self.line_1, unallocated_lines)
# Auto-allocation should skip this line, even though stock exists
self.build.auto_allocate_stock(
interchangeable=True, substitutes=True, optional_items=True
)
self.assertEqual(self.line_1.allocated_quantity(), 0)
self.assertEqual(BuildItem.objects.filter(build_line=self.line_1).count(), 0)
# The other (non-consumable) line should still be allocated as normal
self.assertEqual(self.line_2.allocated_quantity(), 30)
class ExternalBuildTest(InvenTreeAPITestCase): class ExternalBuildTest(InvenTreeAPITestCase):
"""Unit tests for external build order functionality.""" """Unit tests for external build order functionality."""

View File

@ -21,3 +21,13 @@ def validate_build_order_reference(value):
# If we get to here, run the "default" validation routine # If we get to here, run the "default" validation routine
Build.validate_reference_field(value) Build.validate_reference_field(value)
def check_build_output(output, quantity=None):
"""Run a validation check against each output before accepting it for completion.
Arguments:
output (StockItem): The build output to check
quantity (Decimal, optional): The quantity to complete. If None, the full output quantity is assumed.
"""
output.build.can_complete_output(output, quantity=quantity)

View File

@ -115,7 +115,8 @@ class BarcodeScanResultAdmin(admin.ModelAdmin):
class ProjectCodeAdmin(admin.ModelAdmin): class ProjectCodeAdmin(admin.ModelAdmin):
"""Admin settings for ProjectCode.""" """Admin settings for ProjectCode."""
list_display = ('code', 'description') list_display = ('code', 'description', 'active')
list_filter = ('active',)
search_fields = ('code', 'description') search_fields = ('code', 'description')

View File

@ -491,7 +491,7 @@ class ProjectCodeList(DataExportViewMixin, ListCreateAPI):
filter_backends = SEARCH_ORDER_FILTER filter_backends = SEARCH_ORDER_FILTER
ordering_fields = ['code'] ordering_fields = ['code']
filterset_fields = ['active']
search_fields = ['code', 'description'] search_fields = ['code', 'description']

View File

@ -162,13 +162,21 @@ def currency_exchange_plugins() -> Optional[list]:
def get_price( def get_price(
instance, instance,
quantity, quantity,
moq=True, moq: bool = True,
multiples=True, multiples: bool = True,
currency=None, currency: Optional[str] = None,
break_name: str = 'price_breaks', break_name: str = 'price_breaks',
): ):
"""Calculate the price based on quantity price breaks. """Calculate the price based on quantity price breaks.
Arguments:
instance: The model instance which contains the price break information
quantity: The quantity to calculate the price for
moq: If True, then minimum order quantity will be observed (CURRENTLY NOT IMPLEMENTED)
multiples: If True, then order multiples will be observed
currency: The currency code to use for the calculation (default is None)
break_name: The name of the price break field on the instance (default is 'price_breaks')
- Don't forget to add in flat-fee cost (base_cost field) - Don't forget to add in flat-fee cost (base_cost field)
- If MOQ (minimum order quantity) is required, bump quantity - If MOQ (minimum order quantity) is required, bump quantity
- If order multiples are to be observed, then we need to calculate based on that, too - If order multiples are to be observed, then we need to calculate based on that, too
@ -185,7 +193,7 @@ def get_price(
return None return None
# Check if quantity is fraction and disable multiples # Check if quantity is fraction and disable multiples
multiples = quantity % 1 == 0 multiples = multiples and (quantity % 1 == 0)
# Order multiples # Order multiples
if multiples: if multiples:

View File

@ -0,0 +1,22 @@
# Generated by Django 5.2.15 on 2026-06-25 03:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("common", "0044_notificationmessage_charfield_pk"),
]
operations = [
migrations.AddField(
model_name="projectcode",
name="active",
field=models.BooleanField(
default=True,
help_text="Is this project code active?",
verbose_name="Active",
),
),
]

View File

@ -0,0 +1,59 @@
"""Migration to store UUID primary keys as char(32) on MySQL / MariaDB.
On MariaDB 10.7+, Django 5.x creates UUIDField columns with the native 'uuid'
type and writes 36-character (hyphenated) values. Databases migrated under older
Django / MariaDB versions retain char(32) columns, into which the new values
do not fit.
See: https://github.com/inventree/InvenTree/issues/12270
"""
import uuid
from django.db import migrations
import InvenTree.fields
class Migration(migrations.Migration):
dependencies = [('common', '0045_projectcode_active')]
operations = [
migrations.AlterField(
model_name='emailmessage',
name='global_id',
field=InvenTree.fields.InvenTreeUUIDField(
default=uuid.uuid4,
editable=False,
help_text='Unique identifier for this message',
primary_key=True,
serialize=False,
unique=True,
verbose_name='Global ID',
),
),
migrations.AlterField(
model_name='emailthread',
name='global_id',
field=InvenTree.fields.InvenTreeUUIDField(
default=uuid.uuid4,
editable=False,
help_text='Unique identifier for this thread',
primary_key=True,
serialize=False,
verbose_name='Global ID',
),
),
migrations.AlterField(
model_name='webhookmessage',
name='message_id',
field=InvenTree.fields.InvenTreeUUIDField(
default=uuid.uuid4,
editable=False,
help_text='Unique identifier for this message',
primary_key=True,
serialize=False,
verbose_name='Message ID',
),
),
]

View File

@ -181,6 +181,12 @@ class ProjectCode(InvenTree.models.InvenTreeMetadataModel):
help_text=_('Project description'), help_text=_('Project description'),
) )
active = models.BooleanField(
default=True,
verbose_name=_('Active'),
help_text=_('Is this project code active?'),
)
responsible = models.ForeignKey( responsible = models.ForeignKey(
users.models.Owner, users.models.Owner,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
@ -1382,21 +1388,27 @@ class PriceBreak(MetaMixin):
help_text=_('Unit price at specified quantity'), help_text=_('Unit price at specified quantity'),
) )
def convert_to(self, currency_code): def convert_to(self, currency_code: str, raise_error: bool = False):
"""Convert the unit-price at this price break to the specified currency code. """Convert the unit-price at this price break to the specified currency code.
Args: Arguments:
currency_code: The currency code to convert to (e.g "USD" or "AUD") currency_code: The currency code to convert to (e.g "USD" or "AUD")
raise_error: If True, raise an error if the conversion fails. If False, return None.
""" """
try: try:
converted = convert_money(self.price, currency_code) converted = convert_money(self.price, currency_code)
except MissingRate: except MissingRate: # pragma: no cover
InvenTree.exceptions.log_error('PriceBreak.convert_to')
logger.warning( logger.warning(
'No currency conversion rate available for %s -> %s', 'No currency conversion rate available for %s -> %s',
self.price_currency, self.price_currency,
currency_code, currency_code,
) )
return self.price.amount
if raise_error:
raise
return None
return converted.amount return converted.amount
@ -1578,7 +1590,7 @@ class WebhookMessage(models.Model):
worked_on: Was the work on this message finished? worked_on: Was the work on this message finished?
""" """
message_id = models.UUIDField( message_id = InvenTree.fields.InvenTreeUUIDField(
verbose_name=_('Message ID'), verbose_name=_('Message ID'),
help_text=_('Unique identifier for this message'), help_text=_('Unique identifier for this message'),
primary_key=True, primary_key=True,
@ -3260,7 +3272,7 @@ class EmailMessage(models.Model):
TRACK_READ = 'track_read', _('Track Read') TRACK_READ = 'track_read', _('Track Read')
TRACK_CLICK = 'track_click', _('Track Click') TRACK_CLICK = 'track_click', _('Track Click')
global_id = models.UUIDField( global_id = InvenTree.fields.InvenTreeUUIDField(
verbose_name=_('Global ID'), verbose_name=_('Global ID'),
help_text=_('Unique identifier for this message'), help_text=_('Unique identifier for this message'),
primary_key=True, primary_key=True,
@ -3368,7 +3380,7 @@ class EmailThread(InvenTree.models.InvenTreeMetadataModel):
blank=True, blank=True,
help_text=_('Unique key for this thread (used to identify the thread)'), help_text=_('Unique key for this thread (used to identify the thread)'),
) )
global_id = models.UUIDField( global_id = InvenTree.fields.InvenTreeUUIDField(
verbose_name=_('Global ID'), verbose_name=_('Global ID'),
help_text=_('Unique identifier for this thread'), help_text=_('Unique identifier for this thread'),
primary_key=True, primary_key=True,

View File

@ -417,7 +417,14 @@ class ProjectCodeSerializer(DataImportExportSerializerMixin, InvenTreeModelSeria
"""Meta options for ProjectCodeSerializer.""" """Meta options for ProjectCodeSerializer."""
model = common_models.ProjectCode model = common_models.ProjectCode
fields = ['pk', 'code', 'description', 'responsible', 'responsible_detail'] fields = [
'pk',
'code',
'description',
'active',
'responsible',
'responsible_detail',
]
responsible_detail = OwnerSerializer( responsible_detail = OwnerSerializer(
source='responsible', read_only=True, allow_null=True source='responsible', read_only=True, allow_null=True

View File

@ -793,6 +793,14 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = {
'default': False, 'default': False,
'validator': bool, 'validator': bool,
}, },
'STOCK_MERGE_ON_TRANSFER': {
'name': _('Merge stock with existing stock on transfer by default'),
'description': _(
'Default state for merge stock on transfer behaviour. (Can be changed per transfer if desired)'
),
'default': False,
'validator': bool,
},
'BUILDORDER_REFERENCE_PATTERN': { 'BUILDORDER_REFERENCE_PATTERN': {
'name': _('Build Order Reference Pattern'), 'name': _('Build Order Reference Pattern'),
'description': _('Required pattern for generating Build Order reference field'), 'description': _('Required pattern for generating Build Order reference field'),

View File

@ -1,19 +1,7 @@
"""Types for settings.""" """Types for settings."""
import sys
from collections.abc import Callable from collections.abc import Callable
from typing import Any, TypedDict from typing import Any, NotRequired, TypedDict
if sys.version_info >= (3, 11):
from typing import NotRequired # pragma: no cover
else:
class NotRequired: # pragma: no cover
"""NotRequired type helper is only supported with Python 3.11+."""
def __class_getitem__(cls, item):
"""Return the item."""
return item
class SettingsKeyType(TypedDict, total=False): class SettingsKeyType(TypedDict, total=False):

View File

@ -142,12 +142,3 @@ def stock_expiry_enabled():
from common.models import InvenTreeSetting from common.models import InvenTreeSetting
return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY', False, create=False) return InvenTreeSetting.get_setting('STOCK_ENABLE_EXPIRY', False, create=False)
def prevent_build_output_complete_on_incompleted_tests():
"""Returns True if the completion of the build outputs is disabled until the required tests are passed."""
from common.models import InvenTreeSetting
return InvenTreeSetting.get_setting(
'PREVENT_BUILD_COMPLETION_HAVING_INCOMPLETED_TESTS', False, create=False
)

View File

@ -1752,6 +1752,22 @@ class ProjectCodesTest(InvenTreeAPITestCase):
str(response.data['code']), str(response.data['code']),
) )
def test_filter_active(self):
"""Test that the 'active' field can be filtered via the API."""
# Mark one code as inactive
code = ProjectCode.objects.first()
code.active = False
code.save()
active_count = ProjectCode.objects.filter(active=True).count()
inactive_count = ProjectCode.objects.filter(active=False).count()
response = self.get(self.url, data={'active': True}, expected_code=200)
self.assertEqual(len(response.data), active_count)
response = self.get(self.url, data={'active': False}, expected_code=200)
self.assertEqual(len(response.data), inactive_count)
def test_write_access(self): def test_write_access(self):
"""Test that non-staff users have read-only access.""" """Test that non-staff users have read-only access."""
# By default user has staff access, can create a new project code # By default user has staff access, can create a new project code

View File

@ -1,5 +1,6 @@
"""JSON serializers for Company app.""" """JSON serializers for Company app."""
from django.db import transaction
from django.db.models import Prefetch from django.db.models import Prefetch
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -14,6 +15,7 @@ from importer.registry import register_importer
from InvenTree.mixins import DataImportExportSerializerMixin from InvenTree.mixins import DataImportExportSerializerMixin
from InvenTree.ready import isGeneratingSchema from InvenTree.ready import isGeneratingSchema
from InvenTree.serializers import ( from InvenTree.serializers import (
DuplicateOptionsSerializer,
FilterableSerializerMixin, FilterableSerializerMixin,
InvenTreeCurrencySerializer, InvenTreeCurrencySerializer,
InvenTreeDecimalField, InvenTreeDecimalField,
@ -118,6 +120,8 @@ class CompanySerializer(
import_exclude_fields = ['image'] import_exclude_fields = ['image']
SKIP_CREATE_FIELDS = ['duplicate']
class Meta: class Meta:
"""Metaclass options.""" """Metaclass options."""
@ -132,6 +136,7 @@ class CompanySerializer(
'email', 'email',
'currency', 'currency',
'contact', 'contact',
'duplicate',
'link', 'link',
'image', 'image',
'active', 'active',
@ -191,6 +196,23 @@ class CompanySerializer(
parameters = common.filters.enable_parameters_filter() parameters = common.filters.enable_parameters_filter()
duplicate = DuplicateOptionsSerializer(Company.objects.all(), copy_parameters=True)
@transaction.atomic
def create(self, validated_data):
"""Create a new Company instance, optionally copying data from an existing company."""
duplicate = validated_data.pop('duplicate', None)
instance = super().create(validated_data)
if duplicate:
original = duplicate['original']
if duplicate.get('copy_parameters', True):
instance.copy_parameters_from(original)
return instance
@register_importer() @register_importer()
class ContactSerializer(DataImportExportSerializerMixin, InvenTreeModelSerializer): class ContactSerializer(DataImportExportSerializerMixin, InvenTreeModelSerializer):
@ -217,6 +239,8 @@ class ManufacturerPartSerializer(
): ):
"""Serializer for ManufacturerPart object.""" """Serializer for ManufacturerPart object."""
SKIP_CREATE_FIELDS = ['duplicate']
class Meta: class Meta:
"""Metaclass options.""" """Metaclass options."""
@ -229,6 +253,7 @@ class ManufacturerPartSerializer(
'manufacturer', 'manufacturer',
'manufacturer_detail', 'manufacturer_detail',
'description', 'description',
'duplicate',
'MPN', 'MPN',
'link', 'link',
'barcode_hash', 'barcode_hash',
@ -241,6 +266,25 @@ class ManufacturerPartSerializer(
parameters = common.filters.enable_parameters_filter() parameters = common.filters.enable_parameters_filter()
duplicate = DuplicateOptionsSerializer(
ManufacturerPart.objects.all(), copy_parameters=True
)
@transaction.atomic
def create(self, validated_data):
"""Create a new ManufacturerPart instance, optionally copying data from an existing instance."""
duplicate = validated_data.pop('duplicate', None)
instance = super().create(validated_data)
if duplicate:
original = duplicate['original']
if duplicate.get('copy_parameters', True):
instance.copy_parameters_from(original)
return instance
part_detail = OptionalField( part_detail = OptionalField(
serializer_class=part_serializers.PartBriefSerializer, serializer_class=part_serializers.PartBriefSerializer,
serializer_kwargs={ serializer_kwargs={
@ -323,6 +367,8 @@ class SupplierPartSerializer(
export_exclude_fields = ['tags'] export_exclude_fields = ['tags']
SKIP_CREATE_FIELDS = ['duplicate']
export_child_fields = [ export_child_fields = [
'part_detail.name', 'part_detail.name',
'part_detail.description', 'part_detail.description',
@ -339,6 +385,7 @@ class SupplierPartSerializer(
'available', 'available',
'availability_updated', 'availability_updated',
'description', 'description',
'duplicate',
'in_stock', 'in_stock',
'on_order', 'on_order',
'link', 'link',
@ -494,6 +541,10 @@ class SupplierPartSerializer(
# Date fields # Date fields
updated = serializers.DateTimeField(allow_null=True, read_only=True) updated = serializers.DateTimeField(allow_null=True, read_only=True)
duplicate = DuplicateOptionsSerializer(
SupplierPart.objects.all(), copy_parameters=True
)
@staticmethod @staticmethod
def annotate_queryset(queryset): def annotate_queryset(queryset):
"""Annotate the SupplierPart queryset with extra fields. """Annotate the SupplierPart queryset with extra fields.
@ -522,8 +573,11 @@ class SupplierPartSerializer(
return response return response
@transaction.atomic
def create(self, validated_data): def create(self, validated_data):
"""Extract manufacturer data and process ManufacturerPart.""" """Extract manufacturer data and process ManufacturerPart."""
duplicate = validated_data.pop('duplicate', None)
# Extract 'available' quantity from the serializer # Extract 'available' quantity from the serializer
available = validated_data.pop('available', None) available = validated_data.pop('available', None)
@ -541,6 +595,12 @@ class SupplierPartSerializer(
kwargs = {'manufacturer': manufacturer, 'MPN': MPN} kwargs = {'manufacturer': manufacturer, 'MPN': MPN}
supplier_part.save(**kwargs) supplier_part.save(**kwargs)
if duplicate:
original = duplicate['original']
if duplicate.get('copy_parameters', True):
supplier_part.copy_parameters_from(original)
return supplier_part return supplier_part

View File

@ -16,6 +16,7 @@ from taggit.serializers import TagListSerializerField
import data_exporter.serializers import data_exporter.serializers
import data_exporter.tasks import data_exporter.tasks
import InvenTree.exceptions import InvenTree.exceptions
import InvenTree.serializers
from common.models import DataOutput from common.models import DataOutput
from InvenTree.helpers import str2bool from InvenTree.helpers import str2bool
from InvenTree.tasks import offload_task from InvenTree.tasks import offload_task
@ -64,6 +65,14 @@ class DataExportSerializerMixin:
# Exclude fields which are not required for data export # Exclude fields which are not required for data export
for field in self.get_export_exclude_fields(**kwargs): for field in self.get_export_exclude_fields(**kwargs):
self.fields.pop(field, None) self.fields.pop(field, None)
# Duplication options are never used for data export
for field in [
name
for name, field in self.fields.items()
if isinstance(field, InvenTree.serializers.DuplicateOptionsSerializer)
]:
self.fields.pop(field, None)
else: else:
# Exclude fields which are only used for data export # Exclude fields which are only used for data export
for field in self.get_export_only_fields(**kwargs): for field in self.get_export_only_fields(**kwargs):
@ -99,6 +108,10 @@ class DataExportSerializerMixin:
fields.update(self.get_child_fields(name, field)) fields.update(self.get_child_fields(name, field))
continue continue
# Skip 'many' fields (e.g. nested serializers)
if getattr(field, 'many', False):
continue
fields[name] = field fields[name] = field
return fields return fields

View File

@ -3,6 +3,8 @@
from rest_framework import fields, serializers from rest_framework import fields, serializers
from taggit.serializers import TagListSerializerField from taggit.serializers import TagListSerializerField
import InvenTree.serializers
class DataImportSerializerMixin: class DataImportSerializerMixin:
"""Mixin class for adding data import functionality to a DRF serializer.""" """Mixin class for adding data import functionality to a DRF serializer."""
@ -41,6 +43,14 @@ class DataImportSerializerMixin:
for field in self.get_import_exclude_fields(**kwargs): for field in self.get_import_exclude_fields(**kwargs):
self.fields.pop(field, None) self.fields.pop(field, None)
# Duplication options are never used for data import
for field in [
name
for name, field in self.fields.items()
if isinstance(field, InvenTree.serializers.DuplicateOptionsSerializer)
]:
self.fields.pop(field, None)
else: else:
# Exclude fields which are only used for data import # Exclude fields which are only used for data import
for field in self.get_import_only_fields(**kwargs): for field in self.get_import_only_fields(**kwargs):

View File

@ -6,6 +6,7 @@ from datetime import datetime
from typing import Optional from typing import Optional
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import FieldDoesNotExist
from django.core.exceptions import ValidationError as DjangoValidationError from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.validators import FileExtensionValidator from django.core.validators import FileExtensionValidator
from django.db import models from django.db import models
@ -200,7 +201,7 @@ class DataImportSession(models.Model):
related_field = model_class._meta.get_field(field_name) related_field = model_class._meta.get_field(field_name)
model = related_field.remote_field.model model = related_field.remote_field.model
return model return model
except (AttributeError, models.FieldDoesNotExist): except (AttributeError, FieldDoesNotExist):
return None return None
def extract_columns(self) -> None: def extract_columns(self) -> None:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More