Unable to set precision in print format

Hi All ,

I am trying to print a calculated field , I set the float precision to be 2 in the doctype but when printing the field with the below script , it prints more than 6 decimals
<div class="col-xs-1"; style="width: 6%; border: 1px solid #000 ;"><big><b>{{ doc.yield or '0' }}</b></big></div>

yield is a calculated field .

Please help

Hi @srinivasragav,

Try frappe.utils.flt(doc.yield, 2) or doc.get_formatted("yield")

Thanks, Makarand

1 Like

Thank you so much makarand , it worked . In the meantime i gathered a workaround , that is to set the precision in the python custom script for that calculated field .