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

@ -0,0 +1,12 @@
{% load i18n %}
{% if instance and instance.currency %}
<tr>
<td><span class='fas fa-dollar-sign'></span></td>
<td>{% trans "Currency" %}</td>
{% if instance.order_currency %}
<td>{{ instance.currency }}</td>
{% else %}
<td><em>{{ instance.currency }}</em></td>
{% endif %}
</tr>
{% endif %}

View File

@ -65,6 +65,9 @@ function purchaseOrderFields(options={}) {
project_code: {
icon: 'fa-list',
},
order_currency: {
icon: 'fa-coins',
},
target_date: {
icon: 'fa-calendar-alt',
},
@ -1670,7 +1673,7 @@ function loadPurchaseOrderTable(table, options) {
sortable: true,
formatter: function(value, row) {
return formatCurrency(value, {
currency: row.total_price_currency,
currency: row.order_currency,
});
},
},

View File

@ -49,6 +49,9 @@ function returnOrderFields(options={}) {
project_code: {
icon: 'fa-list',
},
order_currency: {
icon: 'fa-coins',
},
target_date: {
icon: 'fa-calendar-alt',
},
@ -349,7 +352,7 @@ function loadReturnOrderTable(table, options={}) {
visible: false,
formatter: function(value, row) {
return formatCurrency(value, {
currency: row.total_price_currency
currency: row.order_currency
});
}
}

View File

@ -62,6 +62,9 @@ function salesOrderFields(options={}) {
project_code: {
icon: 'fa-list',
},
order_currency: {
icon: 'fa-coins',
},
target_date: {
icon: 'fa-calendar-alt',
},
@ -802,7 +805,7 @@ function loadSalesOrderTable(table, options) {
sortable: true,
formatter: function(value, row) {
return formatCurrency(value, {
currency: row.total_price_currency,
currency: row.order_currency,
});
}
}