Compare commits
16 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
12da3b01fc | |
|
|
2df9eb80ca | |
|
|
44387f3bb4 | |
|
|
ed8331e26a | |
|
|
228577c871 | |
|
|
fd7d0bda0f | |
|
|
90e5169283 | |
|
|
198594d7d3 | |
|
|
dededb0aa1 | |
|
|
eb413bcc57 | |
|
|
9b11cd294e | |
|
|
ccf5b39bf1 | |
|
|
eceaa68c32 | |
|
|
ccb4ea248b | |
|
|
9b3b68c8d8 | |
|
|
3752b610c8 |
|
|
@ -37,9 +37,10 @@ RUN apt install -y nodejs npm
|
||||||
# Update to the latest stable node version
|
# Update to the latest stable node version
|
||||||
RUN npm install -g n --ignore-scripts && n lts
|
RUN npm install -g n --ignore-scripts && n lts
|
||||||
|
|
||||||
# Enable yarn
|
# Install yarn
|
||||||
RUN corepack enable && corepack prepare yarn@stable --activate
|
RUN npm install -g yarn
|
||||||
|
|
||||||
|
# Ensure node and yarn are available at the command line
|
||||||
RUN node --version && yarn --version
|
RUN node --version && yarn --version
|
||||||
|
|
||||||
RUN yarn config set httpTimeout 600000 --home
|
RUN yarn config set httpTimeout 600000 --home
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ env:
|
||||||
INVENTREE_SITE_URL: http://localhost:8000
|
INVENTREE_SITE_URL: http://localhost:8000
|
||||||
INVENTREE_DEBUG: true
|
INVENTREE_DEBUG: true
|
||||||
|
|
||||||
|
use_performance: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
|
@ -78,7 +80,7 @@ jobs:
|
||||||
- name: Which runner to use?
|
- name: Which runner to use?
|
||||||
id: runner-perf
|
id: runner-perf
|
||||||
# decide if we are running in inventree/inventree -> use codspeed-macro runner else ubuntu-24.04
|
# decide if we are running in inventree/inventree -> use codspeed-macro runner else ubuntu-24.04
|
||||||
run: echo "runner=$([[ '${{ github.repository }}' == 'inventree/InvenTree' ]] && echo 'codspeed-macro' || echo 'ubuntu-24.04')" >> $GITHUB_OUTPUT
|
run: echo "runner=$([[ '${{ github.repository }}' == 'inventree/InvenTree' ]] && '${{ env.use_performance }}' == 'true' ]] && echo 'codspeed-macro' || echo 'ubuntu-24.04')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
pre-commit:
|
pre-commit:
|
||||||
name: Style [pre-commit]
|
name: Style [pre-commit]
|
||||||
|
|
@ -692,7 +694,13 @@ jobs:
|
||||||
cd src/frontend && npx playwright install --with-deps
|
cd src/frontend && npx playwright install --with-deps
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
id: tests
|
id: tests
|
||||||
run: cd src/frontend && npx nyc playwright test
|
run: |
|
||||||
|
cd src/frontend
|
||||||
|
cp ./tests/fixtures/playwright_custom_logo.png ../backend/InvenTree/InvenTree/static/img/playwright_custom_logo.png
|
||||||
|
cp ./tests/fixtures/playwright_custom_splash.png ../backend/InvenTree/InvenTree/static/img/playwright_custom_splash.png
|
||||||
|
invoke static
|
||||||
|
env INVENTREE_CUSTOM_SPLASH="img/playwright_custom_splash.png" INVENTREE_CUSTOM_LOGO="img/playwright_custom_logo.png" npx nyc playwright test --project=customization
|
||||||
|
npx nyc playwright test --project=chromium --project=firefox
|
||||||
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # pin@v6.0.0
|
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # pin@v6.0.0
|
||||||
if: ${{ !cancelled() && steps.tests.outcome == 'failure' }}
|
if: ${{ !cancelled() && steps.tests.outcome == 'failure' }}
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,11 @@ jobs:
|
||||||
asset_name: frontend-build.zip
|
asset_name: frontend-build.zip
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
- name: Upload frontend to artifacts
|
||||||
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # pin@v6.0.0
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
path: src/backend/InvenTree/web/static/frontend-build.zip
|
||||||
- name: Upload Attestation
|
- name: Upload Attestation
|
||||||
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
||||||
with:
|
with:
|
||||||
|
|
@ -136,3 +141,98 @@ jobs:
|
||||||
asset_name: docs-html.zip
|
asset_name: docs-html.zip
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
|
build-pkgr:
|
||||||
|
if: github.repository == 'inventree/InvenTree'
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build, docs]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- ubuntu:22.04
|
||||||
|
- ubuntu:24.04
|
||||||
|
- debian:12
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Get frontend artifact
|
||||||
|
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # pin@v7.0.0
|
||||||
|
with:
|
||||||
|
name: frontend-build
|
||||||
|
- name: Setup
|
||||||
|
id: setup
|
||||||
|
env:
|
||||||
|
NODE_ID: ${{ github.event.release.node_id }}
|
||||||
|
BRANCH: ${{ github.event.release.target_commitish }}
|
||||||
|
TARGET: ${{github.event.release.target_commitish}}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
run: |
|
||||||
|
# Get info
|
||||||
|
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/$REPO/commits/$TARGET > commit.json
|
||||||
|
|
||||||
|
# Extract info
|
||||||
|
echo "INFO extract | Extracting info from github"
|
||||||
|
DATE=$(jq -r '.commit.committer.date' commit.json)
|
||||||
|
SIGNATURE=$(jq -r '.commit.verification.signature' commit.json)
|
||||||
|
FULL_SHA=$(jq -r '.sha' commit.json)
|
||||||
|
SHA=$(echo "$FULL_SHA" | cut -c1-7)
|
||||||
|
|
||||||
|
echo "INFO write | Write VERSION information"
|
||||||
|
echo "$VERSION" > VERSION
|
||||||
|
echo "INVENTREE_COMMIT_HASH='$SHA'" >> VERSION
|
||||||
|
echo "INVENTREE_COMMIT_SHA='$FULL_SHA'" >> VERSION
|
||||||
|
echo "INVENTREE_COMMIT_DATE='$DATE'" >> VERSION
|
||||||
|
echo "INVENTREE_PKG_INSTALLER='PKG'" >> VERSION
|
||||||
|
echo "INVENTREE_PKG_BRANCH='$BRANCH'" >> VERSION
|
||||||
|
echo "INVENTREE_PKG_TARGET='$TARGET'" >> VERSION
|
||||||
|
echo "NODE_ID='$NODE_ID'" >> VERSION
|
||||||
|
echo "SIGNATURE='$SIGNATURE'" >> VERSION
|
||||||
|
|
||||||
|
echo "INFO write | Written VERSION information"
|
||||||
|
echo "### VERSION ###"
|
||||||
|
cat VERSION
|
||||||
|
echo "### VERSION ###"
|
||||||
|
|
||||||
|
# Move frontend build into place
|
||||||
|
mkdir -p src/backend/InvenTree/web/static
|
||||||
|
unzip -qq frontend-build.zip -d src/backend/InvenTree/web/static/web
|
||||||
|
- name: Package
|
||||||
|
uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # pin@main
|
||||||
|
id: package
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
version: ${{ steps.setup.outputs.version }}
|
||||||
|
debug: true
|
||||||
|
cache_prefix: ${{ github.ref_name }}
|
||||||
|
env: |
|
||||||
|
INVENTREE_DB_ENGINE=sqlite3
|
||||||
|
INVENTREE_DB_NAME=database.sqlite3
|
||||||
|
INVENTREE_PLUGINS_ENABLED=true
|
||||||
|
INVENTREE_MEDIA_ROOT=/opt/inventree/media
|
||||||
|
INVENTREE_STATIC_ROOT=/opt/inventree/static
|
||||||
|
INVENTREE_BACKUP_DIR=/opt/inventree/backup
|
||||||
|
INVENTREE_PLUGIN_FILE=/opt/inventree/plugins.txt
|
||||||
|
INVENTREE_CONFIG_FILE=/opt/inventree/config.yaml
|
||||||
|
APP_REPO=inventree/InvenTree
|
||||||
|
- name: Publish to go.packager.io
|
||||||
|
uses: pkgr/action/publish@3bce081ae512c5020856e237d37b3f5479d4aa71 # pin@main
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
token: ${{ secrets.PACKAGER_RELEASE_TOKEN }}
|
||||||
|
repository: inventree/inventree
|
||||||
|
channel: ${{ github.ref_name }}
|
||||||
|
file: ${{ steps.package.outputs.package_path }}
|
||||||
|
- name: Publish to artifact
|
||||||
|
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: ${{ steps.package.outputs.package_path }}
|
||||||
|
asset_name: ${{ matrix.target }}-{{ steps.setup.outputs.version }}.tar.gz
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
overwrite: true
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ buildpack: https://github.com/matmair/null-buildpack#master
|
||||||
env:
|
env:
|
||||||
- INVENTREE_DB_ENGINE=sqlite3
|
- INVENTREE_DB_ENGINE=sqlite3
|
||||||
- INVENTREE_DB_NAME=database.sqlite3
|
- INVENTREE_DB_NAME=database.sqlite3
|
||||||
- INVENTREE_PLUGINS_ENABLED
|
- INVENTREE_PLUGINS_ENABLED=true
|
||||||
- INVENTREE_MEDIA_ROOT=/opt/inventree/media
|
- INVENTREE_MEDIA_ROOT=/opt/inventree/media
|
||||||
- INVENTREE_STATIC_ROOT=/opt/inventree/static
|
- INVENTREE_STATIC_ROOT=/opt/inventree/static
|
||||||
- INVENTREE_BACKUP_DIR=/opt/inventree/backup
|
- INVENTREE_BACKUP_DIR=/opt/inventree/backup
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ repos:
|
||||||
exclude: mkdocs.yml
|
exclude: mkdocs.yml
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.14.10
|
rev: v0.15.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
args: [--preview]
|
args: [--preview]
|
||||||
|
|
@ -29,7 +29,7 @@ repos:
|
||||||
--preview
|
--preview
|
||||||
]
|
]
|
||||||
- repo: https://github.com/astral-sh/uv-pre-commit
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
||||||
rev: 0.9.22
|
rev: 0.10.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pip-compile
|
- id: pip-compile
|
||||||
name: pip-compile requirements-dev.in
|
name: pip-compile requirements-dev.in
|
||||||
|
|
@ -79,7 +79,7 @@ repos:
|
||||||
src/frontend/vite.config.ts |
|
src/frontend/vite.config.ts |
|
||||||
)$
|
)$
|
||||||
- repo: https://github.com/biomejs/pre-commit
|
- repo: https://github.com/biomejs/pre-commit
|
||||||
rev: v2.3.10
|
rev: v2.3.15
|
||||||
hooks:
|
hooks:
|
||||||
- id: biome-check
|
- id: biome-check
|
||||||
additional_dependencies: ["@biomejs/biome@1.9.4"]
|
additional_dependencies: ["@biomejs/biome@1.9.4"]
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file (starting with 1.0.0).
|
All major notable changes to this project will be documented in this file (starting with 1.0.0).
|
||||||
|
|
||||||
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 - YYYY-MM-DD
|
## 1.2.0 - 2026-02-12
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
- [#10699](https://github.com/inventree/InvenTree/pull/10699) removes the `PartParameter` and `PartParameterTempalate` models (and associated API endpoints). These have been replaced with generic `Parameter` and `ParameterTemplate` models (and API endpoints). Any external client applications which made use of the old endpoints will need to be updated.
|
- [#10699](https://github.com/inventree/InvenTree/pull/10699) removes the `PartParameter` and `PartParameterTemplate` models (and associated API endpoints). These have been replaced with generic `Parameter` and `ParameterTemplate` models (and API endpoints). Any external client applications which made use of the old endpoints will need to be updated.
|
||||||
- [#11035](https://github.com/inventree/InvenTree/pull/11035) moves to a single endpoint for all metadata operations. The previous endpoints for PartMetadata, SupplierPartMetadata, etc have been removed. Any external client applications which made use of the old endpoints will need to be updated.
|
- [#11035](https://github.com/inventree/InvenTree/pull/11035) moves to a single endpoint for all metadata operations. The previous endpoints for PartMetadata, SupplierPartMetadata, etc have been removed. Any external client applications which made use of the old endpoints will need to be updated.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
@ -19,10 +19,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Adds parameter support for multiple new model types in [#10699](https://github.com/inventree/InvenTree/pull/10699)
|
- Adds parameter support for multiple new model types in [#10699](https://github.com/inventree/InvenTree/pull/10699)
|
||||||
- Allows report generator to produce PDF input controls in [#10969](https://github.com/inventree/InvenTree/pull/10969)
|
- Allows report generator to produce PDF input controls in [#10969](https://github.com/inventree/InvenTree/pull/10969)
|
||||||
- UI overhaul of parameter management in [#10699](https://github.com/inventree/InvenTree/pull/10699)
|
- UI overhaul of parameter management in [#10699](https://github.com/inventree/InvenTree/pull/10699)
|
||||||
|
- Allow input controls within generated PDF reports in [#10969](https://github.com/inventree/InvenTree/pull/10969)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
-
|
- Improved stocktake functionality in [#11257](https://github.com/inventree/InvenTree/pull/11257)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Removed python 3.9 / 3.10 support as part of Django 5.2 upgrade in [#10730](https://github.com/inventree/InvenTree/pull/10730)
|
- Removed python 3.9 / 3.10 support as part of Django 5.2 upgrade in [#10730](https://github.com/inventree/InvenTree/pull/10730)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
# - Runs InvenTree web server under django development server
|
# - Runs InvenTree web server under django development server
|
||||||
# - Monitors source files for any changes, and live-reloads server
|
# - Monitors source files for any changes, and live-reloads server
|
||||||
|
|
||||||
FROM python:3.11-slim-trixie@sha256:1d6131b5d479888b43200645e03a78443c7157efbdb730e6b48129740727c312 AS inventree_base
|
# Base image last bumped 2026-02-12
|
||||||
|
FROM python:3.11-slim-trixie@sha256:0b23cfb7425d065008b778022a17b1551c82f8b4866ee5a7a200084b7e2eafbf AS inventree_base
|
||||||
|
|
||||||
# Build arguments for this image
|
# Build arguments for this image
|
||||||
ARG commit_tag=""
|
ARG commit_tag=""
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ Once the migration process completes, the database records are now updated! Rest
|
||||||
|
|
||||||
## Migrating Between Incompatible Database Versions
|
## Migrating Between Incompatible Database Versions
|
||||||
|
|
||||||
There may be occasions when InvenTree data needs to be migrated between two database installations running *incompatible* versions of the database software. For example, InvenTree may be running on a Postgres database running on version 12, and the administrator wishes to migrate the data to a Postgres version 17 database.
|
There may be occasions when InvenTree data needs to be migrated between two database installations running *incompatible* versions of the database software. For example, InvenTree may be running on a Postgres database running on version 12, and the administrator wishes to migrate the data to a Postgres version {{ config.extra.docker_postgres_version }} database.
|
||||||
|
|
||||||
!!! warning "Advanced Procedure"
|
!!! warning "Advanced Procedure"
|
||||||
The following procedure is *advanced*, and should only be attempted by experienced database administrators. Always ensure that database backups are made before attempting any migration procedure.
|
The following procedure is *advanced*, and should only be attempted by experienced database administrators. Always ensure that database backups are made before attempting any migration procedure.
|
||||||
|
|
@ -127,7 +127,7 @@ Due to inherit incompatibilities between different major versions of database so
|
||||||
!!! warning "InvenTree Version"
|
!!! warning "InvenTree Version"
|
||||||
It is *crucial* that both InvenTree database installations are running the same version of InvenTree software! If this is not the case, data migration may fail, and there is a possibility that data corruption can occur. Ensure that the original database is up to date, by running `invoke update`.
|
It is *crucial* that both InvenTree database installations are running the same version of InvenTree software! If this is not the case, data migration may fail, and there is a possibility that data corruption can occur. Ensure that the original database is up to date, by running `invoke update`.
|
||||||
|
|
||||||
The following instructions assume that the source (old) database is Postgres version 15, and the target (new) database is Postgres version 17. Additionally, it assumes that the InvenTree installation is running under [docker / docker compose](./docker.md), for simplicity. Adjust commands as required for other InvenTree configurations or database software.
|
The following instructions assume that the source (old) database is Postgres version 15, and the target (new) database is Postgres version {{ config.extra.docker_postgres_version }}. Additionally, it assumes that the InvenTree installation is running under [docker / docker compose](./docker.md), for simplicity. Adjust commands as required for other InvenTree configurations or database software.
|
||||||
|
|
||||||
The overall procedure is as follows:
|
The overall procedure is as follows:
|
||||||
|
|
||||||
|
|
@ -154,13 +154,13 @@ docker compose down
|
||||||
|
|
||||||
### Remove Old Database Files
|
### Remove Old Database Files
|
||||||
|
|
||||||
The raw database files are incompatible between different major versions of Postgres. Thus, the old database files must be removed before starting the new database.
|
The raw database files are incompatible between different major versions of Postgres. Thus, the old database files must be removed before starting the new database. Rather than removing the database directory, we will move the database files to a temporary location, just in case we need to revert back to the old database.
|
||||||
|
|
||||||
!!! warning "Data Loss"
|
!!! warning "Data Loss"
|
||||||
Ensure that a complete backup of the old database has been made before proceeding! Removing the database files will result in data loss if a backup does not exist.
|
Ensure that a complete backup of the old database has been made before proceeding! Removing the database files will result in data loss if a backup does not exist.
|
||||||
|
|
||||||
```
|
```
|
||||||
rm -rf ./path/to/database/*
|
mv ./path/to/database ./path/to/database_backup
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! info "Database Location"
|
!!! info "Database Location"
|
||||||
|
|
@ -168,7 +168,7 @@ rm -rf ./path/to/database/*
|
||||||
|
|
||||||
### Start New Database
|
### Start New Database
|
||||||
|
|
||||||
Update the InvenTree docker configuration to use the new version of Postgres (e.g. `postgres:17`), and then start the InvenTree installation:
|
Update the InvenTree docker configuration to use the new version of Postgres (e.g. `postgres:{{ config.extra.docker_postgres_version }}`), and then start the InvenTree installation:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,5 @@
|
||||||
# Files generated during unit testing
|
# Files generated during unit testing
|
||||||
_testfolder/
|
_testfolder/
|
||||||
|
|
||||||
|
# Playwright files for CI
|
||||||
|
InvenTree/static/img/playwright*.png
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,11 @@ class InvenTreeConfig(AppConfig):
|
||||||
if MIGRATIONS_CHECK_DONE:
|
if MIGRATIONS_CHECK_DONE:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Exit early if we are not in a state where we can access the database,
|
||||||
|
# otherwise we might end up in a deadlock situation
|
||||||
|
if not InvenTree.ready.canAppAccessDatabase():
|
||||||
|
return
|
||||||
|
|
||||||
if not InvenTree.tasks.check_for_migrations():
|
if not InvenTree.tasks.check_for_migrations():
|
||||||
# Detect if this an empty database - if so, start with a fresh migration
|
# Detect if this an empty database - if so, start with a fresh migration
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,6 @@ def getBlankThumbnail():
|
||||||
|
|
||||||
def getLogoImage(as_file=False, custom=True):
|
def getLogoImage(as_file=False, custom=True):
|
||||||
"""Return the InvenTree logo image, or a custom logo if available."""
|
"""Return the InvenTree logo image, or a custom logo if available."""
|
||||||
"""Return the path to the logo-file."""
|
|
||||||
if custom and settings.CUSTOM_LOGO:
|
if custom and settings.CUSTOM_LOGO:
|
||||||
static_storage = StaticFilesStorage()
|
static_storage = StaticFilesStorage()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,7 @@ from corsheaders.defaults import default_headers as default_cors_headers
|
||||||
|
|
||||||
import InvenTree.backup
|
import InvenTree.backup
|
||||||
from InvenTree.cache import get_cache_config, is_global_cache_enabled
|
from InvenTree.cache import get_cache_config, is_global_cache_enabled
|
||||||
from InvenTree.config import (
|
from InvenTree.config import get_boolean_setting, get_oidc_private_key, get_setting
|
||||||
get_boolean_setting,
|
|
||||||
get_custom_file,
|
|
||||||
get_oidc_private_key,
|
|
||||||
get_setting,
|
|
||||||
)
|
|
||||||
from InvenTree.ready import isInMainThread
|
from InvenTree.ready import isInMainThread
|
||||||
from InvenTree.sentry import default_sentry_dsn, init_sentry
|
from InvenTree.sentry import default_sentry_dsn, init_sentry
|
||||||
from InvenTree.version import checkMinPythonVersion, inventreeCommitHash
|
from InvenTree.version import checkMinPythonVersion, inventreeCommitHash
|
||||||
|
|
@ -1453,12 +1448,9 @@ if len(GLOBAL_SETTINGS_OVERRIDES) > 0:
|
||||||
logger.debug('- Override value for %s = ********', key)
|
logger.debug('- Override value for %s = ********', key)
|
||||||
|
|
||||||
# User interface customization values
|
# User interface customization values
|
||||||
CUSTOM_LOGO = get_custom_file(
|
CUSTOM_LOGO = get_setting('INVENTREE_CUSTOM_LOGO', 'customize.logo', typecast=str)
|
||||||
'INVENTREE_CUSTOM_LOGO', 'customize.logo', 'custom logo', lookup_media=True
|
|
||||||
)
|
CUSTOM_SPLASH = get_setting('INVENTREE_CUSTOM_SPLASH', 'customize.splash', typecast=str)
|
||||||
CUSTOM_SPLASH = get_custom_file(
|
|
||||||
'INVENTREE_CUSTOM_SPLASH', 'customize.splash', 'custom splash'
|
|
||||||
)
|
|
||||||
|
|
||||||
CUSTOMIZE = get_setting(
|
CUSTOMIZE = get_setting(
|
||||||
'INVENTREE_CUSTOMIZE', 'customize', default_value=None, typecast=dict
|
'INVENTREE_CUSTOMIZE', 'customize', default_value=None, typecast=dict
|
||||||
|
|
|
||||||
|
|
@ -587,6 +587,12 @@ def update_exchange_rates(force: bool = False):
|
||||||
Arguments:
|
Arguments:
|
||||||
force: If True, force the update to run regardless of the last update time
|
force: If True, force the update to run regardless of the last update time
|
||||||
"""
|
"""
|
||||||
|
from InvenTree.ready import canAppAccessDatabase
|
||||||
|
|
||||||
|
# Do not update exchange rates if we cannot access the database
|
||||||
|
if not canAppAccessDatabase(allow_test=True, allow_shell=True):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from djmoney.contrib.exchange.models import Rate
|
from djmoney.contrib.exchange.models import Rate
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from django.conf import settings
|
||||||
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.2.0 dev'
|
INVENTREE_SW_VERSION = '1.2.3'
|
||||||
|
|
||||||
# Minimum supported Python version
|
# Minimum supported Python version
|
||||||
MIN_PYTHON_VERSION = (3, 11)
|
MIN_PYTHON_VERSION = (3, 11)
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ logger = structlog.get_logger('inventree')
|
||||||
def currency_code_default(create: bool = True):
|
def currency_code_default(create: bool = True):
|
||||||
"""Returns the default currency code (or USD if not specified)."""
|
"""Returns the default currency code (or USD if not specified)."""
|
||||||
from common.settings import get_global_setting
|
from common.settings import get_global_setting
|
||||||
|
from InvenTree.ready import isRunningBackup, isRunningMigrations
|
||||||
|
|
||||||
|
if isRunningMigrations() or isRunningBackup():
|
||||||
|
# Prevent database writes during migration or backup operations
|
||||||
|
create = False
|
||||||
|
|
||||||
code = ''
|
code = ''
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1216,7 +1216,9 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||||
even if that key does not exist.
|
even if that key does not exist.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
SETTINGS: dict[str, InvenTreeSettingsKeyType]
|
from common.setting.system import SYSTEM_SETTINGS
|
||||||
|
|
||||||
|
SETTINGS: dict[str, InvenTreeSettingsKeyType] = SYSTEM_SETTINGS
|
||||||
|
|
||||||
CHECK_SETTING_KEY = True
|
CHECK_SETTING_KEY = True
|
||||||
|
|
||||||
|
|
@ -1282,9 +1284,6 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||||
|
|
||||||
The keys must be upper-case
|
The keys must be upper-case
|
||||||
"""
|
"""
|
||||||
from common.setting.system import SYSTEM_SETTINGS
|
|
||||||
|
|
||||||
SETTINGS = SYSTEM_SETTINGS
|
|
||||||
|
|
||||||
typ = 'inventree'
|
typ = 'inventree'
|
||||||
|
|
||||||
|
|
@ -1310,6 +1309,8 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||||
|
|
||||||
import common.setting.user
|
import common.setting.user
|
||||||
|
|
||||||
|
SETTINGS = common.setting.user.USER_SETTINGS
|
||||||
|
|
||||||
CHECK_SETTING_KEY = True
|
CHECK_SETTING_KEY = True
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
@ -1321,8 +1322,6 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||||
models.UniqueConstraint(fields=['key', 'user'], name='unique key and user')
|
models.UniqueConstraint(fields=['key', 'user'], name='unique key and user')
|
||||||
]
|
]
|
||||||
|
|
||||||
SETTINGS = common.setting.user.USER_SETTINGS
|
|
||||||
|
|
||||||
typ = 'user'
|
typ = 'user'
|
||||||
extra_unique_fields = ['user']
|
extra_unique_fields = ['user']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from django.core.exceptions import FieldDoesNotExist, ValidationError
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator, URLValidator
|
from django.core.validators import MaxValueValidator, MinValueValidator, URLValidator
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2.sandbox import SandboxedEnvironment
|
||||||
|
|
||||||
import build.validators
|
import build.validators
|
||||||
import common.currency
|
import common.currency
|
||||||
|
|
@ -52,7 +52,7 @@ def validate_part_name_format(value):
|
||||||
p = Part(name='test part', description='some test part')
|
p = Part(name='test part', description='some test part')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Template(value).render({'part': p})
|
SandboxedEnvironment().from_string(value).render({'part': p})
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise ValidationError({'value': str(exc)})
|
raise ValidationError({'value': str(exc)})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,13 @@ def get_global_setting(key, backup_value=None, environment_key=None, **kwargs):
|
||||||
def set_global_setting(key, value, change_user=None, create=True, **kwargs):
|
def set_global_setting(key, value, change_user=None, create=True, **kwargs):
|
||||||
"""Set the value of a global setting using the provided key."""
|
"""Set the value of a global setting using the provided key."""
|
||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
|
from InvenTree.ready import canAppAccessDatabase
|
||||||
|
|
||||||
|
if not canAppAccessDatabase(allow_shell=True, allow_test=True):
|
||||||
|
logger.warning(
|
||||||
|
f'Cannot set global setting "{key}" - database is not accessible'
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
kwargs['change_user'] = change_user
|
kwargs['change_user'] = change_user
|
||||||
kwargs['create'] = create
|
kwargs['create'] = create
|
||||||
|
|
|
||||||
|
|
@ -473,12 +473,19 @@ class PluginsRegistry:
|
||||||
|
|
||||||
# Ensure that each loaded plugin has a valid configuration object in the database
|
# Ensure that each loaded plugin has a valid configuration object in the database
|
||||||
for plugin in self.plugins.values():
|
for plugin in self.plugins.values():
|
||||||
config = self.get_plugin_config(plugin.slug)
|
if config := self.get_plugin_config(plugin.slug):
|
||||||
|
# Ensure mandatory plugins are marked as active
|
||||||
|
if config.is_mandatory() and not config.active:
|
||||||
|
config.active = True
|
||||||
|
|
||||||
# Ensure mandatory plugins are marked as active
|
try:
|
||||||
if config.is_mandatory() and not config.active:
|
config.save(no_reload=True)
|
||||||
config.active = True
|
except (OperationalError, ProgrammingError):
|
||||||
config.save(no_reload=True)
|
# Database is not ready, cannot save config
|
||||||
|
logger.warning(
|
||||||
|
"Database not ready - cannot set mandatory flag for plugin '%s'",
|
||||||
|
plugin.slug,
|
||||||
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception('Unexpected error during plugin reload: %s', e)
|
logger.exception('Unexpected error during plugin reload: %s', e)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class SampleValidatorPlugin(SettingsMixin, ValidationMixin, InvenTreePlugin):
|
||||||
|
|
||||||
if isinstance(instance, part.models.BomItem):
|
if isinstance(instance, part.models.BomItem):
|
||||||
if self.get_setting('BOM_ITEM_INTEGER'):
|
if self.get_setting('BOM_ITEM_INTEGER'):
|
||||||
if float(instance.quantity) != int(instance.quantity):
|
if float(instance.quantity) != int(instance.quantity): # noqa: RUF069
|
||||||
self.raise_error({
|
self.raise_error({
|
||||||
'quantity': 'Bom item quantity must be an integer'
|
'quantity': 'Bom item quantity must be an integer'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ from inspect import signature
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.template import Context, Template
|
||||||
from jinja2 import Template
|
|
||||||
|
|
||||||
import common.models
|
import common.models
|
||||||
import InvenTree.exceptions
|
import InvenTree.exceptions
|
||||||
|
|
@ -76,7 +75,7 @@ def generate_batch_code(**kwargs):
|
||||||
'STOCK_BATCH_CODE_TEMPLATE', ''
|
'STOCK_BATCH_CODE_TEMPLATE', ''
|
||||||
)
|
)
|
||||||
|
|
||||||
return Template(batch_template).render(context)
|
return Template(batch_template).render(Context(context))
|
||||||
|
|
||||||
|
|
||||||
def generate_serial_number(part=None, quantity=1, **kwargs) -> Optional[str]:
|
def generate_serial_number(part=None, quantity=1, **kwargs) -> Optional[str]:
|
||||||
|
|
|
||||||
|
|
@ -10,24 +10,40 @@ def add_part_links(apps, schema_editor):
|
||||||
|
|
||||||
history_entries = []
|
history_entries = []
|
||||||
|
|
||||||
for tracking in StockItemTracking.objects.all():
|
N = StockItemTracking.objects.count()
|
||||||
|
|
||||||
|
if N > 0:
|
||||||
|
print(f"\nUpdating {N} StockItemTracking entries with part links...")
|
||||||
|
|
||||||
|
for tracking in StockItemTracking.objects.filter(part__isnull=True).select_related('item__part'):
|
||||||
|
|
||||||
item = tracking.item
|
item = tracking.item
|
||||||
|
|
||||||
|
# No item link - skip
|
||||||
if item is None:
|
if item is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
part = item.part
|
part = item.part
|
||||||
|
|
||||||
|
# No part link - skip
|
||||||
if part is None:
|
if part is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Already linked to the correct part - skip
|
||||||
|
if tracking.part == part:
|
||||||
|
continue
|
||||||
|
|
||||||
tracking.part = part
|
tracking.part = part
|
||||||
history_entries.append(tracking)
|
history_entries.append(tracking)
|
||||||
|
|
||||||
|
# Process in batches to avoid issues with very large datasets
|
||||||
|
if len(history_entries) >= 100:
|
||||||
|
StockItemTracking.objects.bulk_update(history_entries, ['part'])
|
||||||
|
history_entries = []
|
||||||
|
print(".", end='', flush=True)
|
||||||
|
|
||||||
if len(history_entries) > 0:
|
if len(history_entries) > 0:
|
||||||
StockItemTracking.objects.bulk_update(history_entries, ['part'])
|
StockItemTracking.objects.bulk_update(history_entries, ['part'])
|
||||||
print(f"\nUpdated {len(history_entries)} StockItemTracking entries with part links")
|
|
||||||
|
|
||||||
|
|
||||||
def remove_null_items(apps, schema_editor):
|
def remove_null_items(apps, schema_editor):
|
||||||
|
|
|
||||||
|
|
@ -962,7 +962,9 @@ class StockItemListTest(StockAPITestCase):
|
||||||
|
|
||||||
# Note: While the export is quick on pgsql, it is still quite slow on sqlite3
|
# Note: While the export is quick on pgsql, it is still quite slow on sqlite3
|
||||||
with self.export_data(
|
with self.export_data(
|
||||||
self.list_url, max_query_count=50, max_query_time=9.0
|
self.list_url,
|
||||||
|
max_query_count=50,
|
||||||
|
max_query_time=12.0, # Test time increased due to worker variability
|
||||||
) as data_file:
|
) as data_file:
|
||||||
data = self.process_csv(data_file)
|
data = self.process_csv(data_file)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,22 @@ export default defineConfig({
|
||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
use: {
|
use: {
|
||||||
...devices['Desktop Chrome']
|
...devices['Desktop Chrome']
|
||||||
}
|
},
|
||||||
|
testIgnore: /customization/ // Ignore all tests in the "customization" folder for this project
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'firefox',
|
||||||
use: {
|
use: {
|
||||||
...devices['Desktop Firefox']
|
...devices['Desktop Firefox']
|
||||||
}
|
},
|
||||||
|
testIgnore: /customization/ // Ignore all tests in the "customization" folder for this project
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'customization',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Firefox']
|
||||||
|
},
|
||||||
|
testIgnore: /pui_.*\.spec\.ts/ // Ignore all "pui_*.spec.ts" tests for this project
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ export const queryClient = new QueryClient({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
export function setTraceId() {
|
export function setTraceId() {
|
||||||
|
// check if we are in a secure context (https) - if not use of crypto is not allowed
|
||||||
|
if (!window.isSecureContext) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
const runID = crypto.randomUUID().replace(/-/g, '');
|
const runID = crypto.randomUUID().replace(/-/g, '');
|
||||||
const traceid = `00-${runID}-${frontendID}-01`;
|
const traceid = `00-${runID}-${frontendID}-01`;
|
||||||
api.defaults.headers['traceparent'] = traceid;
|
api.defaults.headers['traceparent'] = traceid;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { ActionIcon } from '@mantine/core';
|
import { ActionIcon } from '@mantine/core';
|
||||||
import { forwardRef } from 'react';
|
import { type ReactNode, forwardRef } from 'react';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { useShallow } from 'zustand/react/shallow';
|
||||||
|
import { useServerApiState } from '../../states/ServerApiState';
|
||||||
import InvenTreeIcon from './inventree.svg';
|
import InvenTreeIcon from './inventree.svg';
|
||||||
|
|
||||||
export const InvenTreeLogoHomeButton = forwardRef<HTMLDivElement>(
|
export const InvenTreeLogoHomeButton = forwardRef<HTMLDivElement>(
|
||||||
|
|
@ -19,6 +21,21 @@ export const InvenTreeLogoHomeButton = forwardRef<HTMLDivElement>(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const InvenTreeLogo = () => {
|
/*
|
||||||
|
* Render the InvenTree logo
|
||||||
|
* - Uses the custom logo if one is defined on the server
|
||||||
|
* - Otherwise, uses the default logo
|
||||||
|
*/
|
||||||
|
export function InvenTreeLogo(): ReactNode {
|
||||||
|
const [server] = useServerApiState(
|
||||||
|
useShallow((state) => [state.server, state.fetchServerApiState])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (server.server && server.customize?.logo) {
|
||||||
|
return (
|
||||||
|
<img src={server.customize.logo} alt={t`InvenTree Logo`} height={28} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return <img src={InvenTreeIcon} alt={t`InvenTree Logo`} height={28} />;
|
return <img src={InvenTreeIcon} alt={t`InvenTree Logo`} height={28} />;
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,10 @@ export type StockColumnProps = TableColumnProps & {
|
||||||
// Render a StockItem instance within a table
|
// Render a StockItem instance within a table
|
||||||
export function StockColumn(props: StockColumnProps): TableColumn {
|
export function StockColumn(props: StockColumnProps): TableColumn {
|
||||||
return {
|
return {
|
||||||
accessor: props.accessor ?? 'stock_item',
|
|
||||||
title: t`Stock Item`,
|
title: t`Stock Item`,
|
||||||
...props,
|
...props,
|
||||||
|
ordering: props.ordering || 'stock',
|
||||||
|
accessor: props.accessor || 'stock',
|
||||||
render: (record: any) => {
|
render: (record: any) => {
|
||||||
const stock_item =
|
const stock_item =
|
||||||
resolveItem(record, props.accessor ?? 'stock_item_detail') ?? {};
|
resolveItem(record, props.accessor ?? 'stock_item_detail') ?? {};
|
||||||
|
|
|
||||||
|
|
@ -486,6 +486,10 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
||||||
tableState.setPage(1);
|
tableState.setPage(1);
|
||||||
setSortStatus(status);
|
setSortStatus(status);
|
||||||
|
|
||||||
|
if (!status.columnAccessor) {
|
||||||
|
console.error('Invalid column accessor provided for table sorting');
|
||||||
|
}
|
||||||
|
|
||||||
setTableSorting(cacheKey)(status);
|
setTableSorting(cacheKey)(status);
|
||||||
},
|
},
|
||||||
[cacheKey]
|
[cacheKey]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import test, { expect } from '@playwright/test';
|
||||||
|
import { navigate } from '../helpers';
|
||||||
|
import { doLogin } from '../login';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for user interface customization functionality.
|
||||||
|
*
|
||||||
|
* Note: The correct environment variables must be set for these tests to work correctly. See "playwright.config.ts" for details.
|
||||||
|
* These tests are designed to run in CI environments where specific environment variables are set to enable custom logos and splash screens. The tests verify that these customizations are correctly applied in the user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
test('Customization - Splash', async ({ page }) => {
|
||||||
|
await navigate(page, '/');
|
||||||
|
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Check for the custom splash screen
|
||||||
|
await expect(
|
||||||
|
page.locator('[style*="playwright_custom_splash.png"]')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Customization - Logo', async ({ page }) => {
|
||||||
|
await doLogin(page, {
|
||||||
|
username: 'noaccess',
|
||||||
|
password: 'youshallnotpass'
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await page.waitForTimeout(2500);
|
||||||
|
return;
|
||||||
|
});
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 496 B |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Loading…
Reference in New Issue