Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matmair committed Jun 4, 2024
2 parents fc35295 + 2b8e8e5 commit 9a8715f
Show file tree
Hide file tree
Showing 205 changed files with 41,358 additions and 37,975 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ services:
POSTGRES_USER: inventree_user
POSTGRES_PASSWORD: inventree_password

redis:
image: redis:7.0
restart: always
expose:
- 6379

inventree:
build:
context: ..
Expand All @@ -31,6 +37,8 @@ services:
INVENTREE_DB_HOST: db
INVENTREE_DB_USER: inventree_user
INVENTREE_DB_PASSWORD: inventree_password
INVENTREE_CACHE_HOST: redis
INVENTREE_CACHE_PORT: 6379
INVENTREE_PLUGINS_ENABLED: True
INVENTREE_SITE_URL: http://localhost:8000
INVENTREE_CORS_ORIGIN_ALLOW_ALL: True
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Refer to the [getting started guide](https://docs.inventree.org/en/latest/start/
<!-- Mobile App -->
## :iphone: Mobile App

InvenTree is supported by a [companion mobile app](https://docs.inventree.org/en/latest/app/app/) which allows users access to stock control information and functionality.
InvenTree is supported by a [companion mobile app](https://docs.inventree.org/app/) which allows users access to stock control information and functionality.

<div align="center"><h4>
<a href="https://play.google.com/store/apps/details?id=inventree.inventree_app">Android Play Store</a>
Expand Down
1 change: 1 addition & 0 deletions contrib/container/.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INVENTREE_DB_PASSWORD=pgpassword
# Un-comment the following lines to enable Redis cache
# Note that you will also have to run docker-compose with the --profile redis command
# Refer to settings.py for other cache options
#INVENTREE_CACHE_ENABLED=True
#INVENTREE_CACHE_HOST=inventree-cache
#INVENTREE_CACHE_PORT=6379

Expand Down
5 changes: 0 additions & 5 deletions contrib/container/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,9 @@ services:
restart: unless-stopped

# redis acts as database cache manager
# only runs under the "redis" profile : https://docs.docker.com/compose/profiles/
inventree-cache:
image: redis:7.0
container_name: inventree-cache
depends_on:
- inventree-db
profiles:
- redis
env_file:
- .env
expose:
Expand Down
12 changes: 12 additions & 0 deletions docs/docs/build/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ Each *Build Order* has an associated *Status* flag, which indicates the state of
| `Cancelled` | Build has been cancelled |
| `Completed` | Build has been completed |

**Source Code**

Refer to the source code for the Build Order status codes:

::: build.status_codes.BuildStatus
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []

### Stock Allocations

When a *Build Order* is created, we then have the ability to *allocate* stock items against that build order. The particular parts we need to allocate against the build are specified by the BOM for the part we are assembling.
Expand Down
11 changes: 9 additions & 2 deletions docs/docs/develop/devcontainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ You need to make sure that you have the following tools installed before continu

#### Docker Containers

The InvenTree devcontainer setup will install two docker containers:
The InvenTree devcontainer setup will install the following docker containers:

| Container | Description |
| --- | --- |
| inventree | InvenTree host server |
| db | InvenTree database (postgresql) |
| inventree | InvenTree server |
| redis | Redis server for caching |

#### Setup/Installation

Expand Down Expand Up @@ -119,3 +120,9 @@ If you are running a devcontainer in Windows, you may experience some performanc
For a significant improvement in performance, the source code should be installed into the **WSL 2** filesystem (not on your "Windows" filesystem). This will greatly improve file access performance, and also make the devcontainer much more responsive to file system changes.

You can also refer to the [Improve disk performance guide](https://code.visualstudio.com/remote/advancedcontainers/improve-performance) for more information.

### Redis Caching

The devcontainer setup provides a [redis](https://redis.io/) container which can be used for managing global cache. By default this is disabled, but it can be easily enabled for testing or developing with the [redis cache](../start/config.md#caching) enabled.

To enable the cache, locate the InvenTree configuration file (`./dev/config.yaml`) and set the `cache.enabled` setting to `True`.
14 changes: 14 additions & 0 deletions docs/docs/order/purchase_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ Each Purchase Order has a specific status code which indicates the current state
| In Progress | The purchase order has been issued to the supplier, and is in progress |
| Complete | The purchase order has been completed, and is now closed |
| Cancelled | The purchase order was cancelled, and is now closed |
| Lost | The purchase order was lost, and is now closed |
| Returned | The purchase order was returned, and is now closed |

**Source Code**

Refer to the source code for the Purchase Order status codes:

::: order.status_codes.PurchaseOrderStatus
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []

### Purchase Order Currency

Expand Down
12 changes: 12 additions & 0 deletions docs/docs/order/return_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ Each Return Order has a specific status code, as follows:
| Complete | The return order was marked as complete, and is now closed |
| Cancelled | The return order was cancelled, and is now closed |

**Source Code**

Refer to the source code for the Return Order status codes:

::: order.status_codes.ReturnOrderStatus
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []

## Create a Return Order

From the Return Order index, click on <span class='badge inventree add'><span class='fas fa-plus-circle'></span> New Return Order</span> which opens the "Create Return Order" form.
Expand Down
19 changes: 17 additions & 2 deletions docs/docs/order/sales_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,23 @@ Each Sales Order has a specific status code, which represents the state of the o
| --- | --- |
| Pending | The sales order has been created, but has not been finalized or submitted |
| In Progress | The sales order has been issued, and is in progress |
| Shipped | The sales order has been completed, and is now closed |
| Shipped | The sales order has been shipped, but is not yet complete |
| Complete | The sales order is fully completed, and is now closed |
| Cancelled | The sales order was cancelled, and is now closed |
| Lost | The sales order was lost, and is now closed |
| Returned | The sales order was returned, and is now closed |

**Source Code**

Refer to the source code for the Sales Order status codes:

::: order.status_codes.SalesOrderStatus
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []

### Sales Order Currency

Expand Down Expand Up @@ -83,7 +98,7 @@ To view all the completed shipment, click on the <span class="badge inventree na

### Complete Order

Once all items in the sales order have been shipped, click on <span class="badge inventree add"><span class='fas fa-check-circle'></span> Complete Order</span> to mark the sales order as complete.
Once all items in the sales order have been shipped, click on <span class="badge inventree add"><span class='fas fa-check-circle'></span> Complete Order</span> to mark the sales order as shipped. Confirm then click on <span class="badge inventree confirm">Submit</span> to complete the order.

### Cancel Order

Expand Down
17 changes: 11 additions & 6 deletions docs/docs/settings/currency.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ title: Currency Support

InvenTree provides support for multiple currencies, allowing pricing information to be stored with base currency rates.

### Configuration
### Supported Currencies

To specify which currencies are supported, refer to the [currency configuration](../start/config.md#supported-currencies) section
InvenTree uses the [django-money](https://github.com/django-money/django-money) library, which in turn uses the [py-moneyed library](https://py-moneyed.readthedocs.io/en/latest/index.html). `py-moneyed` supports any currency which is defined in the [ISO 3166 standard](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) standard.

### Currency Conversion

Currency conversion is provided via the [django-money](https://github.com/django-money/django-money) library. Pricing data can be converted seamlessly between the available currencies.
Currency conversion is provided via the `django-money` library. Pricing data can be converted seamlessly between the available currencies.

### Currency Rate Updates

Expand All @@ -26,6 +26,11 @@ If a different currency exchange backend is needed, or a custom implementation i

In the [settings screen](./global.md), under the *Pricing* section, the following currency settings are available:

{% with id="currency-settings", url="settings/currency.png", description="Currency Exchange Settings" %}
{% include 'img.html' %}
{% endwith %}
| Setting | Description | Default Value |
| --- | --- |
| Default Currency | The selected *default* currency for the system. | USD |
| Supported Currencies | The list of supported currencies for the system. | AUD, CAD, CNY, EUR, GBP, JPY, NZD, USD |

#### Supported Currencies

While InvenTree can support any of the currencies defined in the ISO 3166 standard, the list of supported currencies can be limited to only those which are relevant to the user. The supported currencies are used to populate the currency selection dropdowns throughout the InvenTree interface.
42 changes: 29 additions & 13 deletions docs/docs/start/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,35 @@ If running with a MySQL database backend, the following additional options are a
| --- | --- | --- | --- |
| INVENTREE_DB_ISOLATION_SERIALIZABLE | database.serializable | Database isolation level configured to "serializable" | False |

## Caching

InvenTree can be configured to use [redis](https://redis.io) as a global cache backend.
Enabling a global cache can provide significant performance improvements for InvenTree.

### Cache Server

Enabling global caching requires connection to a redis server (which is separate from the InvenTree database and web server). Setup and configuration of this server is outside the scope of this documentation. It is assumed that if you are configuring a cache server, you have already set one up, and are comfortable configuring it.

!!! tip "Docker Support"
If you are running [InvenTree under docker](./docker.md), we provide a redis container as part of our docker compose file - so redis caching works out of the box.

### Cache Settings

The following cache settings are available:

| Environment Variable | Configuration File | Description | Default |
| --- | --- | --- | --- |
| INVENTREE_CACHE_ENABLED | cache.enabled | Enable redis caching | False |
| INVENTREE_CACHE_HOST | cache.host | Cache server host | *Not specified* |
| INVENTREE_CACHE_PORT | cache.port | Cache server port | 6379 |
| INVENTREE_CACHE_CONNECT_TIMEOUT | cache.connect_timeout | Cache connection timeout (seconds) | 3 |
| INVENTREE_CACHE_TIMEOUT | cache.timeout | Cache timeout (seconds) | 3 |
| INVENTREE_CACHE_TCP_KEEPALIVE | cache.tcp_keepalive | Cache TCP keepalive | True |
| INVENTREE_CACHE_KEEPALIVE_COUNT | cache.keepalive_count | Cache keepalive count | 5 |
| INVENTREE_CACHE_KEEPALIVE_IDLE | cache.keepalive_idle | Cache keepalive idle | 1 |
| INVENTREE_CACHE_KEEPALIVE_INTERVAL | cache.keepalive_interval | Cache keepalive interval | 1 |
| INVENTREE_CACHE_USER_TIMEOUT | cache.user_timeout | Cache user timeout | 1000 |

## Email Settings

To enable [email functionality](../settings/email.md), email settings must be configured here, either via environment variables or within the configuration file.
Expand All @@ -227,19 +256,6 @@ The "sender" email address is the address from which InvenTree emails are sent (
!!! info "Fallback"
If `INVENTREE_EMAIL_SENDER` is not provided, the system will fall back to `INVENTREE_EMAIL_USERNAME` (if the username is a valid email address)

## Supported Currencies

The currencies supported by InvenTree must be specified in the [configuration file](#configuration-file).

A list of currency codes (e.g. *AUD*, *CAD*, *JPY*, *USD*) can be specified using the `currencies` variable (or using the `INVENTREE_CURRENCIES` environment variable).

| Environment Variable | Configuration File | Description | Default |
| --- | --- | --- | --- |
| INVENTREE_CURRENCIES | currencies | List of supported currencies| `AUD`, `CAD`, `CNY`, `EUR`, `GBP`, `JPY`, `NZD`, `USD` |

!!! tip "More Info"
Read the [currencies documentation](../settings/currency.md) for more information on currency support in InvenTree

## File Storage Locations

InvenTree requires some external directories for storing files:
Expand Down
6 changes: 2 additions & 4 deletions docs/docs/start/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@ This container uses the official [redis image](https://hub.docker.com/_/redis).
Docker adds an additional network layer - that might lead to lower performance than bare metal.
To optimize and configure your redis deployment follow the [official docker guide](https://redis.io/docs/getting-started/install-stack/docker/#configuration).

!!! warning "Disabled by default"
The *redis* container is not enabled in the default configuration. This is provided as an example for users wishing to use redis.
To enable the *redis* container, run any `docker compose` commands with the `--profile redis` flag.
You will also need to un-comment the `INVENTREE_CACHE_<...>` variables in the `.env` file.
!!! tip "Enable Cache"
While a redis container is provided in the default configuration, by default it is not enabled in the Inventree server. You can enable redis cache support by following the [caching configuration guide](./config.md#caching)

### Data Volume

Expand Down
12 changes: 12 additions & 0 deletions docs/docs/stock/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ The *status* of a given stock item is displayed on the stock item detail page:
{% include 'img.html' %}
{% endwith %}

**Source Code**

Refer to the source code for the Stock status codes:

::: stock.status_codes.StockStatus
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []

### Default Status Code

The default status code for any newly created Stock Item is <span class='badge inventree success'>OK</span>
Expand Down
10 changes: 9 additions & 1 deletion src/backend/InvenTree/InvenTree/api_version.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
"""InvenTree API version information."""

# InvenTree API version
INVENTREE_API_VERSION = 202
INVENTREE_API_VERSION = 205

"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""

INVENTREE_API_TEXT = """
v205 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7284
- Added model_type and model_id fields to the "NotesImage" serializer
v204 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7393
- Fixes previous API update which resulted in inconsistent ordering of currency codes
v203 - 2024-06-03 : https://github.com/inventree/InvenTree/pull/7390
- Currency codes are now configurable as a run-time setting
v202 - 2024-05-27 : https://github.com/inventree/InvenTree/pull/7343
- Adjust "required" attribute of Part.category field to be optional
Expand Down
2 changes: 1 addition & 1 deletion src/backend/InvenTree/InvenTree/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def update_exchange_rates(self): # pragma: no cover
try:
from djmoney.contrib.exchange.models import ExchangeBackend

from common.settings import currency_code_default
from common.currency import currency_code_default
from InvenTree.tasks import update_exchange_rates
except AppRegistryNotReady: # pragma: no cover
pass
Expand Down
Loading

0 comments on commit 9a8715f

Please sign in to comment.