2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-18 23:17:41 +00:00

Report maths tweaks (#10604)

* Maths tags updates

- Allow maths operations on non-float values
- Add tests for Decimal values
- Add tests for Money values
- Convert string values to floating point

* Add modulo tag
This commit is contained in:
Oliver
2025-10-17 20:54:20 +11:00
committed by GitHub
parent 24dfbe815e
commit d534f67c62
3 changed files with 101 additions and 15 deletions

View File

@@ -263,7 +263,11 @@ Total Price: {% render_currency order.total_price currency='NZD' decimal_places=
## Maths Operations
Simple mathematical operators are available, as demonstrated in the example template below:
Simple mathematical operators are available, as demonstrated in the example template below. These operators can be used to perform basic arithmetic operations within the report template.
### Input Types
These mathematical functions accept inputs of various input types, and attempt to perform the operation accordingly. Note that any inputs which are provided as strings will be converted to floating point numbers before the operation is performed.
### add
@@ -293,6 +297,13 @@ Simple mathematical operators are available, as demonstrated in the example temp
show_docstring_description: false
show_source: False
### modulo
::: report.templatetags.report.modulo
options:
show_docstring_description: false
show_source: False
### Example
```html