mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-18 12:56:31 -06:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be3e2b4e01 | ||
|
|
3fc2db6c3a | ||
|
|
79325c96d0 | ||
|
|
62425f1f3b | ||
|
|
200c1dfe06 | ||
|
|
8c0b35ba69 | ||
|
|
b1d0f3cb9e |
@@ -166,6 +166,18 @@ function detect_envs() {
|
||||
export INVENTREE_DB_PASSWORD=$(jq -r '.[].database.PASSWORD' <<< ${INVENTREE_CONF_DATA})
|
||||
export INVENTREE_DB_HOST=$(jq -r '.[].database.HOST' <<< ${INVENTREE_CONF_DATA})
|
||||
export INVENTREE_DB_PORT=$(jq -r '.[].database.PORT' <<< ${INVENTREE_CONF_DATA})
|
||||
|
||||
# Parse site URL if not already set
|
||||
if [ -z "${INVENTREE_SITE_URL}" ]; then
|
||||
# Try to read out the app config
|
||||
if [ -n "$(inventree config:get INVENTREE_SITE_URL)" ]; then
|
||||
echo "# POI03| Getting site URL from app config"
|
||||
export INVENTREE_SITE_URL=$(inventree config:get INVENTREE_SITE_URL)
|
||||
else
|
||||
echo "# POI03| Getting site URL from config file"
|
||||
export INVENTREE_SITE_URL=$(jq -r '.[].site_url' <<< ${INVENTREE_CONF_DATA})
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "# POI03| No config file found: ${INVENTREE_CONFIG_FILE}, using envs or defaults"
|
||||
|
||||
@@ -190,6 +202,8 @@ function detect_envs() {
|
||||
export INVENTREE_DB_HOST=${INVENTREE_DB_HOST:-samplehost}
|
||||
export INVENTREE_DB_PORT=${INVENTREE_DB_PORT:-123456}
|
||||
|
||||
export INVENTREE_SITE_URL=${INVENTREE_SITE_URL}
|
||||
|
||||
export SETUP_CONF_LOADED=true
|
||||
fi
|
||||
|
||||
@@ -209,6 +223,7 @@ function detect_envs() {
|
||||
fi
|
||||
echo "# POI03| INVENTREE_DB_HOST=${INVENTREE_DB_HOST}"
|
||||
echo "# POI03| INVENTREE_DB_PORT=${INVENTREE_DB_PORT}"
|
||||
echo "# POI03| INVENTREE_SITE_URL=${INVENTREE_SITE_URL}"
|
||||
}
|
||||
|
||||
function create_initscripts() {
|
||||
@@ -313,7 +328,7 @@ function update_or_install() {
|
||||
# Run update as app user
|
||||
echo "# POI12| Updating InvenTree"
|
||||
sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && pip install wheel"
|
||||
sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && invoke update | sed -e 's/^/# POI12| u | /;'"
|
||||
sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && set -e && invoke update | sed -e 's/^/# POI12| u | /;'"
|
||||
|
||||
# Make sure permissions are correct again
|
||||
echo "# POI12| Set permissions for data dir and media: ${DATA_DIR}"
|
||||
@@ -373,10 +388,15 @@ function set_site() {
|
||||
|
||||
# Check if INVENTREE_SITE_URL in inventree config
|
||||
if [ -z "$(inventree config:get INVENTREE_SITE_URL)" ]; then
|
||||
echo "# POI14| Setting up InvenTree site URL"
|
||||
inventree config:set INVENTREE_SITE_URL=http://${INVENTREE_IP}
|
||||
# Prefer current INVENTREE_SITE_URL if set
|
||||
if [ -n "${INVENTREE_SITE_URL}" ]; then
|
||||
inventree config:set INVENTREE_SITE_URL=${INVENTREE_SITE_URL}
|
||||
else
|
||||
echo "# POI14| Setting up InvenTree site URL"
|
||||
inventree config:set INVENTREE_SITE_URL=http://${INVENTREE_IP}
|
||||
fi
|
||||
else
|
||||
echo "# POI14| Site URL already set - skipping"
|
||||
echo "# POI14| Site URL already set to '$INVENTREE_SITE_URL' - skipping"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -385,11 +405,16 @@ function final_message() {
|
||||
echo -e "####################################################################################"
|
||||
echo -e "This InvenTree install uses nginx, the settings for the webserver can be found in"
|
||||
echo -e "${SETUP_NGINX_FILE}"
|
||||
echo -e "Try opening InvenTree with either\nhttp://localhost/ or http://${INVENTREE_IP}/\n"
|
||||
echo -e "Admin user data:"
|
||||
echo -e " Email: ${INVENTREE_ADMIN_EMAIL}"
|
||||
echo -e " Username: ${INVENTREE_ADMIN_USER}"
|
||||
echo -e " Password: ${INVENTREE_ADMIN_PASSWORD}"
|
||||
echo -e "Try opening InvenTree with any of \n${INVENTREE_SITE_URL} , http://localhost/ or http://${INVENTREE_IP}/ \n"
|
||||
# Print admin user data only if set
|
||||
if ["${INVENTREE_ADMIN_USER}" ]; then
|
||||
echo -e "Admin user data:"
|
||||
echo -e " Email: ${INVENTREE_ADMIN_EMAIL}"
|
||||
echo -e " Username: ${INVENTREE_ADMIN_USER}"
|
||||
echo -e " Password: ${INVENTREE_ADMIN_PASSWORD}"
|
||||
else
|
||||
echo -e "No admin set during this operation - depending on the deployment method a admin user might have been created with an initial password saved in `${SETUP_ADMIN_PASSWORD_FILE}`"
|
||||
fi
|
||||
echo -e "####################################################################################"
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ echo "# POI01| Importing functions"
|
||||
echo "# POI01| Functions imported"
|
||||
|
||||
# Envs that should be passed to setup commands
|
||||
export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_SITE_URL,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON,SETUP_ADMIN_NOCREATION
|
||||
export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,INVENTREE_SITE_URL,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON,SETUP_ADMIN_NOCREATION
|
||||
|
||||
# Get the envs
|
||||
detect_local_env
|
||||
|
||||
@@ -6,7 +6,7 @@ echo "# PRI01| Running preinstall script - start - $(date)"
|
||||
PATH=${APP_HOME}/env/bin:${APP_HOME}/:/sbin:/bin:/usr/sbin:/usr/bin:
|
||||
|
||||
# Envs that should be passed to setup commands
|
||||
export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON
|
||||
export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,INVENTREE_SITE_URL,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON
|
||||
|
||||
if test -f "${APP_HOME}/env/bin/pip"; then
|
||||
# Check if clear-generated is available
|
||||
|
||||
@@ -88,11 +88,17 @@ Note that inherited BOM Line Items only flow "downwards" in the variant inherita
|
||||
|
||||
## BOM Creation
|
||||
|
||||
BOMs can be created manually, by adjusting individual line items, or by upload an existing BOM file.
|
||||
BOMs can be created manually, by adjusting individual line items, or by uploading (importing) an existing BOM file.
|
||||
|
||||
### Importing a BOM
|
||||
|
||||
BOM data can be imported from an existing file (such as CSV or Excel) from the *BOM* panel for a particular part/assembly. This process is a special case of the more general [data import process](../settings/import.md).
|
||||
|
||||
At the top of the *BOM* panel, click on the {{ icon("file-arrow-left", color="green", title="Import BOM Data") }} icon to open the import dialog.
|
||||
|
||||
### Add BOM Item
|
||||
|
||||
To manually add a BOM item, navigate to the part/assembly detail page then click on the "BOM" tab. On top of the tab view, click on the {{ icon("edit", color="blue", title="Edit") }} icon then, after the page reloads, click on the {{ icon("plus-circle") }} icon.
|
||||
To manually add a BOM item, navigate to the part/assembly detail page then click on the *BOM* panel tab. On top of the *BOM* view, click on the {{ icon("edit", color="blue", title="Edit") }} icon then, after the page reloads, click on the {{ icon("plus-circle") }} icon.
|
||||
|
||||
The `Create BOM Item` form will be displayed:
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@ Errors - These are critical errors which should be addressed as soon as possible
|
||||
#### INVE-E1
|
||||
**No frontend included - Backend/web**
|
||||
|
||||
Only stable / production releases of InvenTree include the frontend panel. This is both a measure of resource-saving and attack surface reduction. If you want to use the frontend panel, you can either:″
|
||||
Only stable / production releases of InvenTree include the frontend panel. This is both a measure of resource-saving and attack surface reduction.
|
||||
|
||||
If you want to use the frontend panel, you can either:
|
||||
|
||||
- use a docker image that is version-tagged or the stable version
|
||||
- use a package version that is from the stable or version stream
|
||||
- use a package version that is from the stable or version stream - if you are and it is not working, run `sudo inventree run cli update` to re-run the upgrade
|
||||
- install node and yarn on the server to build the frontend with the [invoke](../start/invoke.md) task `int.frontend-build`
|
||||
|
||||
Raise an issue if none of these options work.
|
||||
|
||||
@@ -17,6 +17,7 @@ from error_report.middleware import ExceptionProcessor
|
||||
from common.settings import get_global_setting
|
||||
from InvenTree.AllUserRequire2FAMiddleware import AllUserRequire2FAMiddleware
|
||||
from InvenTree.cache import create_session_cache, delete_session_cache
|
||||
from InvenTree.config import CONFIG_LOOKUPS, inventreeInstaller
|
||||
from users.models import ApiToken
|
||||
|
||||
logger = structlog.get_logger('inventree')
|
||||
@@ -252,7 +253,11 @@ class InvenTreeHostSettingsMiddleware(MiddlewareMixin):
|
||||
# The used url might not be the primary url - next check determines if in a trusted origins
|
||||
pass
|
||||
else:
|
||||
msg = f'INVE-E7: The used path `{accessed_scheme}` does not match the SITE_URL `{settings.SITE_URL}`'
|
||||
source = CONFIG_LOOKUPS.get('INVENTREE_SITE_URL', {}).get(
|
||||
'source', 'unknown'
|
||||
)
|
||||
dpl_method = inventreeInstaller()
|
||||
msg = f'INVE-E7: The visited path `{accessed_scheme}` does not match the SITE_URL `{settings.SITE_URL}`. The INVENTREE_SITE_URL is set via `{source}` config method - deployment method `{dpl_method}`'
|
||||
logger.error(msg)
|
||||
return render(
|
||||
request, 'config_error.html', {'error_message': msg}, status=500
|
||||
|
||||
@@ -126,7 +126,7 @@ class MiddlewareTests(InvenTreeTestCase):
|
||||
SITE_LAX_PROTOCOL_CHECK=False,
|
||||
):
|
||||
response = self.client.get(reverse('web'))
|
||||
self.assertContains(response, 'INVE-E7: The used path', status_code=500)
|
||||
self.assertContains(response, 'INVE-E7: The visited path', status_code=500)
|
||||
|
||||
def test_site_url_checks_multi(self):
|
||||
"""Test that the site URL check is correctly working in a multi-site setup."""
|
||||
@@ -194,7 +194,9 @@ class MiddlewareTests(InvenTreeTestCase):
|
||||
):
|
||||
response = self.client.get(reverse('web'))
|
||||
self.assertContains(
|
||||
response, 'INVE-E7: The used path `http://testserver` ', status_code=500
|
||||
response,
|
||||
'INVE-E7: The visited path `http://testserver` ',
|
||||
status_code=500,
|
||||
)
|
||||
self.assertNotContains(
|
||||
response, 'window.INVENTREE_SETTINGS', status_code=500
|
||||
@@ -212,6 +214,6 @@ class MiddlewareTests(InvenTreeTestCase):
|
||||
# Check that the correct step triggers the error message
|
||||
self.assertContains(
|
||||
response,
|
||||
'INVE-E7: The used path `http://testserver` does not match',
|
||||
'INVE-E7: The visited path `http://testserver` does not match',
|
||||
status_code=500,
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.conf import settings
|
||||
from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION
|
||||
|
||||
# InvenTree software version
|
||||
INVENTREE_SW_VERSION = '1.0.3'
|
||||
INVENTREE_SW_VERSION = '1.0.5'
|
||||
|
||||
|
||||
logger = logging.getLogger('inventree')
|
||||
|
||||
@@ -38,6 +38,10 @@ class InvenTreeUINotifications(NotificationMixin, InvenTreePlugin):
|
||||
if not users:
|
||||
return False
|
||||
|
||||
# Ensure that there is always target object - see https://github.com/inventree/InvenTree/issues/10435
|
||||
if not target:
|
||||
target = self.plugin_config()
|
||||
|
||||
# Bulk create notification messages for all provided users
|
||||
for user in users:
|
||||
entries.append(
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<div id="root">If you see this text there might be an Issue with your update - see <a href="https://docs.inventree.org/en/stable/settings/error_codes/#inve-e1">INVE-E1</a> in the docs for help</div>
|
||||
<div id="spa_settings">{% spa_settings %}</div>
|
||||
{% if bundle == "NOT_FOUND" %}
|
||||
<div id="spa_bundle_error">
|
||||
|
||||
Reference in New Issue
Block a user