mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +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:
		| @@ -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> | ||||
|  | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user