Row.get_formatted with maths operand

Hi All,

I want to return the field amount from quotation_item multiplied by 0.1 as a value in a custom print format. But I also want it to be formatted like currency (2 decimal places). So I am trying variations like:

{{ row.get_formatted("amount"*0.1) }}
{{ row.get_formatted("amount")*0.1 }}

But getting error:

TypeError: can't multiply sequence by non-int of type 'float'

Seems pretty self-explanatory but why can’t I multiply a floating point value?

Please help me with the syntax.


The first one is syntactically incorrect. Hence the error.

The second one looks okay. Just remove {{ row.get_formatted("amount"*0.1) }}

Thanks @anand but what I meant was I tried those 2 statements separately and both gave the same error. I just tried again with only the second syntax and it’s giving the error:

TypeError: can't multiply sequence by non-int of type 'float'

Still looking for how I can do it :slight_smile:

Fixed! Thanks again to @max_morais_dmm and his phenomenal knowledge!

The syntax needs to be:

{{ frappe.format_value(row.amount*0.1, row.meta.get_field('amount'), row) }}

Otherwise you have problems doing the multiplication due to the value having become a string (non-mathematical).