Multiplication in print format returns error {{ body }}

I am redesigning the sales order and got some custom fields that need to be calculated in the print format, but when I do that multiplication it returns an error when I print it.

the syntax I use is:

{{ row.qty * row.count}}

in the preview it will show the correct information but when I click on print to print it, it will show a new empty white page with only 1 text {{ body }}

P.s: using row as this is done in loop of item.

Also tried the below with no improvement:

{{ (row.stone_1_count*row.qty) }}

Any help would be much appreciated

Should actually do what you intend to do.
What is the error?

Did you check the types? E.g. if one of the operands is a “None” there might be a problem.

@Paul_Frydlewicz There is no errors in logs or in UI.

The value shows correctly in preview, but when I want to print it (click the ‘print’ button from inside the preview) it opens a new page with only {{body}} in it.

Did you try to assign the result to a variable first and then to print it?
Something like:
{% set A = B*C %}
{{ A }}

I tried already and did not have any issue.

So, even though the fields were set as int, when calling it in print format it was changed somehow to what i assume to be a something else (not string but something else).

i tried to manipulate it and convert it to int in jinja like so: {{row.stone * row.qty |int}} but this was not enough.

It is solved when i figured out i need to change both values to int using: {{row.stone |int * row.qty |int}} and that solved it.

1 Like

Yes that makes complete sense. Glad you could solve it :+1::+1:

1 Like

This topic was automatically closed after 4 days. New replies are no longer allowed.