mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue6281
This commit is contained in:
3
.github/workflows/check_translations.yaml
vendored
3
.github/workflows/check_translations.yaml
vendored
@ -22,7 +22,8 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
INVENTREE_DB_NAME: "./test_db.sqlite"
|
INVENTREE_DB_NAME: "./test_db.sqlite"
|
||||||
INVENTREE_DB_ENGINE: django.db.backends.sqlite3
|
INVENTREE_DB_ENGINE: django.db.backends.sqlite3
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_MEDIA_ROOT: ./media
|
INVENTREE_MEDIA_ROOT: ./media
|
||||||
INVENTREE_STATIC_ROOT: ./static
|
INVENTREE_STATIC_ROOT: ./static
|
||||||
INVENTREE_BACKUP_DIR: ./backup
|
INVENTREE_BACKUP_DIR: ./backup
|
||||||
|
44
.github/workflows/qc_checks.yaml
vendored
44
.github/workflows/qc_checks.yaml
vendored
@ -242,6 +242,8 @@ jobs:
|
|||||||
INVENTREE_PYTHON_TEST_USERNAME: testuser
|
INVENTREE_PYTHON_TEST_USERNAME: testuser
|
||||||
INVENTREE_PYTHON_TEST_PASSWORD: testpassword
|
INVENTREE_PYTHON_TEST_PASSWORD: testpassword
|
||||||
INVENTREE_SITE_URL: http://127.0.0.1:12345
|
INVENTREE_SITE_URL: http://127.0.0.1:12345
|
||||||
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2
|
||||||
@ -324,7 +326,8 @@ jobs:
|
|||||||
INVENTREE_DB_PASSWORD: password
|
INVENTREE_DB_PASSWORD: password
|
||||||
INVENTREE_DB_HOST: "127.0.0.1"
|
INVENTREE_DB_HOST: "127.0.0.1"
|
||||||
INVENTREE_DB_PORT: 5432
|
INVENTREE_DB_PORT: 5432
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_CACHE_HOST: localhost
|
INVENTREE_CACHE_HOST: localhost
|
||||||
INVENTREE_PLUGINS_ENABLED: true
|
INVENTREE_PLUGINS_ENABLED: true
|
||||||
|
|
||||||
@ -372,7 +375,8 @@ jobs:
|
|||||||
INVENTREE_DB_PASSWORD: password
|
INVENTREE_DB_PASSWORD: password
|
||||||
INVENTREE_DB_HOST: "127.0.0.1"
|
INVENTREE_DB_HOST: "127.0.0.1"
|
||||||
INVENTREE_DB_PORT: 3306
|
INVENTREE_DB_PORT: 3306
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_PLUGINS_ENABLED: true
|
INVENTREE_PLUGINS_ENABLED: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@ -417,7 +421,8 @@ jobs:
|
|||||||
INVENTREE_DB_PASSWORD: password
|
INVENTREE_DB_PASSWORD: password
|
||||||
INVENTREE_DB_HOST: "127.0.0.1"
|
INVENTREE_DB_HOST: "127.0.0.1"
|
||||||
INVENTREE_DB_PORT: 5432
|
INVENTREE_DB_PORT: 5432
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_PLUGINS_ENABLED: false
|
INVENTREE_PLUGINS_ENABLED: false
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@ -459,7 +464,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
INVENTREE_DB_ENGINE: sqlite3
|
INVENTREE_DB_ENGINE: sqlite3
|
||||||
INVENTREE_DB_NAME: /home/runner/work/InvenTree/db.sqlite3
|
INVENTREE_DB_NAME: /home/runner/work/InvenTree/db.sqlite3
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_PLUGINS_ENABLED: false
|
INVENTREE_PLUGINS_ENABLED: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -474,12 +480,6 @@ jobs:
|
|||||||
- name: Fetch Database
|
- name: Fetch Database
|
||||||
run: git clone --depth 1 https://github.com/inventree/test-db ./test-db
|
run: git clone --depth 1 https://github.com/inventree/test-db ./test-db
|
||||||
|
|
||||||
- name: Latest Database
|
|
||||||
run: |
|
|
||||||
cp test-db/latest.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
|
||||||
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
|
||||||
invoke migrate
|
|
||||||
|
|
||||||
- name: 0.10.0 Database
|
- name: 0.10.0 Database
|
||||||
run: |
|
run: |
|
||||||
rm /home/runner/work/InvenTree/db.sqlite3
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
@ -494,13 +494,6 @@ jobs:
|
|||||||
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
invoke migrate
|
invoke migrate
|
||||||
|
|
||||||
- name: 0.12.0 Database
|
|
||||||
run: |
|
|
||||||
rm /home/runner/work/InvenTree/db.sqlite3
|
|
||||||
cp test-db/stable_0.12.0.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
|
||||||
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
|
||||||
invoke migrate
|
|
||||||
|
|
||||||
- name: 0.13.5 Database
|
- name: 0.13.5 Database
|
||||||
run: |
|
run: |
|
||||||
rm /home/runner/work/InvenTree/db.sqlite3
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
@ -508,6 +501,21 @@ jobs:
|
|||||||
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
invoke migrate
|
invoke migrate
|
||||||
|
|
||||||
|
- name: 0.16.0 Database
|
||||||
|
run: |
|
||||||
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
cp test-db/stable_0.13.5.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
invoke migrate
|
||||||
|
|
||||||
|
- name: 0.17.0 Database
|
||||||
|
run: |
|
||||||
|
rm /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
cp test-db/stable_0.13.5.sqlite3 /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
chmod +rw /home/runner/work/InvenTree/db.sqlite3
|
||||||
|
invoke migrate
|
||||||
|
|
||||||
|
|
||||||
platform_ui:
|
platform_ui:
|
||||||
name: Tests - Platform UI
|
name: Tests - Platform UI
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
@ -517,7 +525,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
INVENTREE_DB_ENGINE: sqlite3
|
INVENTREE_DB_ENGINE: sqlite3
|
||||||
INVENTREE_DB_NAME: /home/runner/work/InvenTree/db.sqlite3
|
INVENTREE_DB_NAME: /home/runner/work/InvenTree/db.sqlite3
|
||||||
INVENTREE_DEBUG: True
|
INVENTREE_DEBUG: true
|
||||||
INVENTREE_PLUGINS_ENABLED: false
|
INVENTREE_PLUGINS_ENABLED: false
|
||||||
VITE_COVERAGE: true
|
VITE_COVERAGE: true
|
||||||
|
|
||||||
|
3
.github/workflows/translations.yaml
vendored
3
.github/workflows/translations.yaml
vendored
@ -23,7 +23,8 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
INVENTREE_DB_NAME: "./test_db.sqlite"
|
INVENTREE_DB_NAME: "./test_db.sqlite"
|
||||||
INVENTREE_DB_ENGINE: django.db.backends.sqlite3
|
INVENTREE_DB_ENGINE: django.db.backends.sqlite3
|
||||||
INVENTREE_DEBUG: info
|
INVENTREE_DEBUG: true
|
||||||
|
INVENTREE_LOG_LEVEL: INFO
|
||||||
INVENTREE_MEDIA_ROOT: ./media
|
INVENTREE_MEDIA_ROOT: ./media
|
||||||
INVENTREE_STATIC_ROOT: ./static
|
INVENTREE_STATIC_ROOT: ./static
|
||||||
INVENTREE_BACKUP_DIR: ./backup
|
INVENTREE_BACKUP_DIR: ./backup
|
||||||
|
@ -78,7 +78,7 @@ if version_file.exists():
|
|||||||
|
|
||||||
# Default action is to run the system in Debug mode
|
# Default action is to run the system in Debug mode
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = get_boolean_setting('INVENTREE_DEBUG', 'debug', True)
|
DEBUG = get_boolean_setting('INVENTREE_DEBUG', 'debug', False)
|
||||||
|
|
||||||
# Configure logging settings
|
# Configure logging settings
|
||||||
LOG_LEVEL = get_setting('INVENTREE_LOG_LEVEL', 'log_level', 'WARNING')
|
LOG_LEVEL = get_setting('INVENTREE_LOG_LEVEL', 'log_level', 'WARNING')
|
||||||
@ -1146,7 +1146,9 @@ SESSION_COOKIE_SECURE = (
|
|||||||
if DEBUG
|
if DEBUG
|
||||||
else (
|
else (
|
||||||
SESSION_COOKIE_SAMESITE == 'None'
|
SESSION_COOKIE_SAMESITE == 'None'
|
||||||
or get_boolean_setting('INVENTREE_SESSION_COOKIE_SECURE', 'cookie.secure', True)
|
or get_boolean_setting(
|
||||||
|
'INVENTREE_SESSION_COOKIE_SECURE', 'cookie.secure', False
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ database:
|
|||||||
# PORT: Database host port (if required)
|
# PORT: Database host port (if required)
|
||||||
|
|
||||||
# Set debug to False to run in production mode, or use the environment variable INVENTREE_DEBUG
|
# Set debug to False to run in production mode, or use the environment variable INVENTREE_DEBUG
|
||||||
debug: True
|
debug: False
|
||||||
|
|
||||||
# Additional debug options
|
# Additional debug options
|
||||||
debug_querycount: False
|
debug_querycount: False
|
||||||
@ -124,9 +124,9 @@ use_x_forwarded_host: false
|
|||||||
use_x_forwarded_port: false
|
use_x_forwarded_port: false
|
||||||
|
|
||||||
# Cookie settings (nominally the default settings should be fine)
|
# Cookie settings (nominally the default settings should be fine)
|
||||||
#cookie:
|
cookie:
|
||||||
# secure: false
|
secure: false
|
||||||
# samesite: false
|
samesite: false
|
||||||
|
|
||||||
# Cross Origin Resource Sharing (CORS) settings (see https://github.com/adamchainz/django-cors-headers)
|
# Cross Origin Resource Sharing (CORS) settings (see https://github.com/adamchainz/django-cors-headers)
|
||||||
cors:
|
cors:
|
||||||
|
@ -1504,17 +1504,22 @@ class StockItem(
|
|||||||
"""
|
"""
|
||||||
return self.children.count()
|
return self.children.count()
|
||||||
|
|
||||||
def is_in_stock(self, check_status: bool = True):
|
def is_in_stock(
|
||||||
|
self, check_status: bool = True, check_quantity: bool = True
|
||||||
|
) -> bool:
|
||||||
"""Return True if this StockItem is "in stock".
|
"""Return True if this StockItem is "in stock".
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
check_status: If True, check the status of the StockItem. Defaults to True.
|
check_status: If True, check the status of the StockItem. Defaults to True.
|
||||||
|
check_quantity: If True, check the quantity of the StockItem. Defaults to True.
|
||||||
"""
|
"""
|
||||||
if check_status and self.status not in StockStatusGroups.AVAILABLE_CODES:
|
if check_status and self.status not in StockStatusGroups.AVAILABLE_CODES:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if check_quantity and self.quantity <= 0:
|
||||||
|
return False
|
||||||
|
|
||||||
return all([
|
return all([
|
||||||
self.quantity > 0, # Quantity must be greater than zero
|
|
||||||
self.sales_order is None, # Not assigned to a SalesOrder
|
self.sales_order is None, # Not assigned to a SalesOrder
|
||||||
self.belongs_to is None, # Not installed inside another StockItem
|
self.belongs_to is None, # Not installed inside another StockItem
|
||||||
self.customer is None, # Not assigned to a customer
|
self.customer is None, # Not assigned to a customer
|
||||||
|
@ -1571,7 +1571,9 @@ class StockAdjustmentItemSerializer(serializers.Serializer):
|
|||||||
'STOCK_ALLOW_OUT_OF_STOCK_TRANSFER', backup_value=False, cache=False
|
'STOCK_ALLOW_OUT_OF_STOCK_TRANSFER', backup_value=False, cache=False
|
||||||
)
|
)
|
||||||
|
|
||||||
if not allow_out_of_stock_transfer and not pk.is_in_stock(check_status=False):
|
if not allow_out_of_stock_transfer and not pk.is_in_stock(
|
||||||
|
check_status=False, check_quantity=False
|
||||||
|
):
|
||||||
raise ValidationError(_('Stock item is not in stock'))
|
raise ValidationError(_('Stock item is not in stock'))
|
||||||
|
|
||||||
return pk
|
return pk
|
||||||
|
@ -661,7 +661,6 @@ export default function StockDetail() {
|
|||||||
const stockActions = useMemo(() => {
|
const stockActions = useMemo(() => {
|
||||||
const inStock =
|
const inStock =
|
||||||
user.hasChangeRole(UserRoles.stock) &&
|
user.hasChangeRole(UserRoles.stock) &&
|
||||||
stockitem.quantity > 0 &&
|
|
||||||
!stockitem.sales_order &&
|
!stockitem.sales_order &&
|
||||||
!stockitem.belongs_to &&
|
!stockitem.belongs_to &&
|
||||||
!stockitem.customer &&
|
!stockitem.customer &&
|
||||||
@ -717,7 +716,7 @@ export default function StockDetail() {
|
|||||||
{
|
{
|
||||||
name: t`Remove`,
|
name: t`Remove`,
|
||||||
tooltip: t`Remove Stock`,
|
tooltip: t`Remove Stock`,
|
||||||
hidden: serialized || !inStock,
|
hidden: serialized || !inStock || stockitem.quantity <= 0,
|
||||||
icon: <InvenTreeIcon icon='remove' iconProps={{ color: 'red' }} />,
|
icon: <InvenTreeIcon icon='remove' iconProps={{ color: 'red' }} />,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
stockitem.pk && removeStockItem.open();
|
stockitem.pk && removeStockItem.open();
|
||||||
|
Reference in New Issue
Block a user