2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

Report template currency updates (#4469)

* Move render_currency into helpers.py

- Add duplicate tag to report.py
- Add option for currency conversion (optional)

* Update report templates

- Use "render_currency" instead of including price_data template

* Remove 'price_data.html' template entirely
This commit is contained in:
Oliver
2023-03-08 23:26:26 +11:00
committed by GitHub
parent beac7d15df
commit 34875828d7
10 changed files with 84 additions and 65 deletions

View File

@ -107,8 +107,8 @@ table td.expand {
</td>
<td>{{ line.reference }}</td>
<td>{% decimal line.quantity %}</td>
<td>{% include "price_data.html" with price=line.purchase_price %}</td>
<td>{% include "price_data.html" with price=line.total_line_price %}</td>
<td>{% render_currency line.price decimal_places=2 %}</td>
<td>{% render_currency line.total_line_price decimal_places=2 %}</td>
<td>{{ line.notes }}</td>
</tr>
{% endfor %}
@ -120,8 +120,8 @@ table td.expand {
<td><!-- No part --></td>
<td>{{ line.reference }}</td>
<td>{% decimal line.quantity %}</td>
<td>{% include "price_data.html" with price=line.price %}</td>
<td>{% include "price_data.html" with price=line.total_line_price %}</td>
<td>{% render_currency line.price decimal_places=2 %}</td>
<td>{% render_currency line.total_line_price decimal_places=2 %}</td>
<td>{{ line.notes }}</td>
</tr>
{% endfor %}
@ -132,7 +132,7 @@ table td.expand {
<td></td>
<td></td>
<th>{% trans "Total" %}</th>
<td>{% include "price_data.html" with price=order.total_price %}</td>
<td>{% render_currency order.total_price decimal_places=2 currency=order.supplier.currency %}</td>
<td></td>
</tr>

View File

@ -108,8 +108,8 @@ table td.expand {
</td>
<td>{{ line.reference }}</td>
<td>{% decimal line.quantity %}</td>
<td>{% include "price_data.html" with price=line.sale_price %}</td>
<td>{% include "price_data.html" with price=line.total_line_price %}</td>
<td>{% render_currency line.price %}</td>
<td>{% render_currency line.total_line_price %}</td>
<td>{{ line.notes }}</td>
</tr>
{% endfor %}
@ -121,8 +121,8 @@ table td.expand {
<td><!-- No part --></td>
<td>{{ line.reference }}</td>
<td>{% decimal line.quantity %}</td>
<td>{% include "price_data.html" with price=line.price %}</td>
<td>{% include "price_data.html" with price=line.total_line_price %}</td>
<td>{% render_currency line.price %}</td>
<td>{% render_currency line.total_line_price %}</td>
<td>{{ line.notes }}</td>
</tr>
{% endfor %}
@ -133,7 +133,7 @@ table td.expand {
<td></td>
<td></td>
<th>{% trans "Total" %}</th>
<td>{% include "price_data.html" with price=order.total_price %}</td>
<td>{% render_currency order.total_price currency=order.customer.currency %}</td>
<td></td>
</tr>
</tbody>

View File

@ -208,3 +208,10 @@ def multiply(x, y):
def divide(x, y):
"""Divide one number by another"""
return x / y
@register.simple_tag
def render_currency(money, **kwargs):
"""Render a currency / Money object"""
return InvenTree.helpers.render_currency(money, **kwargs)