2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +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

@ -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