2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 18:15:40 +00:00

Specify order currency (#4698)

* Add 'order_currency' to the various external order models

- By default will use the currency specified for the supplier (or customer)
- Can be specified per order, also

* Display order currency on order pgae

* Add 'order_currency' field

* Enable "blank" currency option (to default to the currency specified by the referenced company

* Fix default currency code when adding line items

* Remove 'total_price_currency' serializer field

- Now replaced with 'order_currency' for greater flexibility

* Bump api_version.py

* Update default order report templates

* Updated docs

* More docs updaes

* Adjust unit tests

* Use 'order_currency' in order tables

* Update purchase order api unit tests
This commit is contained in:
Oliver
2023-04-26 17:35:15 +10:00
committed by GitHub
parent 36d17c082b
commit 5fcab2aec3
22 changed files with 199 additions and 35 deletions

View File

@ -21,7 +21,7 @@ $ pip install -r requirements.txt
To serve the pages locally, run the following command (from the top-level project directory):
```
$ mkdocs serve -a localhost:8080
$ mkdocs serve -f docs/mkdocs.yml -a localhost:8080
```
## Edit Documentation Files

View File

@ -23,6 +23,10 @@ Each Purchase Order has a specific status code which indicates the current state
| Complete | The purchase order has been completed, and is now closed |
| Cancelled | The purchase order was cancelled, and is now closed |
### Purchase Order Currency
The currency code can be specified for an individual purchase order. If not specified, the default currency specified against the [supplier](./supplier.md) will be used.
## Create Purchase Order
Once the purchase order page is loaded, click on <span class="badge inventree add"><span class='fas fa-plus-circle'></span> New Purchase Order</span> which opens the "Create Purchase Order" form.

View File

@ -27,9 +27,11 @@ In addition to the default report context variables, the following variables are
| order.creation_date | The date when the order was created |
| order.target_date | The date when the order should arrive |
| order.if_overdue | Boolean value that tells if the target date has passed |
| order.currency | The currency code associated with this order, e.g. 'AUD' |
#### Lines
The lines have sub variables.
Each line item have sub variables, as follows:
| Variable | Description |
| --- | --- |
@ -39,9 +41,20 @@ The lines have sub variables.
| reference | The reference given in the part of the order |
| notes | The notes given in the part of the order |
| target_date | The date when the part should arrive. Each part can have an individual date |
| price | The price the part supplierpart |
| price | The unit price the line item |
| total_line_price | The total price for this line item, calculated from the unit price and quantity |
| destination | The stock location where the part will be stored |
A simple example below shows how to use the context variables for line items:
```html
{% raw %}
{% for line in order.lines %}
Price: {% render_currency line.total_line_price %}
{% endfor %}
{% endraw %}
```
### Default Report Template

View File

@ -22,6 +22,7 @@ In addition to the default report context variables, the following variables are
| customer | The [customer](../sell/customer.md) associated with the particular sales order |
| lines | A list of available line items for this order |
| extra_lines | A list of available *extra* line items for this order |
| order.currency | The currency code associated with this order, e.g. 'CAD' |
### Default Report Template

View File

@ -23,6 +23,11 @@ Each Sales Order has a specific status code, which represents the state of the o
| Complete | The sales order has been completed, and is now closed |
| Cancelled | The sales order was cancelled, and is now closed |
### Sales Order Currency
The currency code can be specified for an individual sales order. If not specified, the default currency specified against the [customer](./customer.md) will be used.
## Create a Sales Order
Once the sales order page is loaded, click on <span class="badge inventree add"><span class='fas fa-plus-circle'></span> New Sales Order</span> which opens the "Create Sales Order" form.