Odoo Help


Format amount in email template

Laurent Simonin
on 4/30/15, 4:20 PM 1,222 views

In my email I model shows the amount with :

"${object.amount_total} ${object.currency_id.name}" 

Unfortunately the amount does not display correctly.

It is displayed: 480.0 instead of 480.00

In all modules Odoo it's ok, it's only in email templates.

Thank you


You need to format the value before sending it to the template, as Odoo uses a different templating engine for emails... You add your "formated" value to context in your python code before calling the template, and then inside the template you access it with ${ctx.get('my_param_name')}

Mario Arias Badila
on 4/30/15, 9:19 PM

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

| 3 3 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 5/1/15, 12:02 PM

Yes, you can edit the template...

${"%.2f" % object.amount_total} 

A suggestion !!!
Update the template from email.template.form and add widget="text" for field "body_html", because the cke editor break complex templates with %if and co... BEFORE to edit the email template !

Let us know ! 

Laurent Simonin
On 5/1/15, 3:13 AM

@Jérémy Kersten, thank you it's work fine.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 4/30/15, 4:20 PM
Seen: 1222 times
Last updated: 11/14/15, 6:04 AM