Odoo Help

Welcome!

This community 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.

2

Format amount in email template

By
Laurent Simonin
on 4/30/15, 4:20 PM 626 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
3

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 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 ! 

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

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

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