Odoo Help

0

Email dynamic fields

By
Martin T
on 1/13/14, 11:16 AM 3,165 views

I'm customizing the Sales Order - Send by Email template. and I want to change the one of the first lines of the template.

Hello ${object.partner_id.name},

to

Dear $(object.partnerIid.title) $(object.partner_id.name),

Unfortunately this is not working.

I get browse_record(res.partner.tittle,6) instead of Sir.

How can I change the template so I get the correct title?

2
Paul Catinean
On 1/13/14, 4:15 PM

First of all you have a typo in your code

Dear $(object.partnerIid.title) should be ${object.partner_id.title}

Next the title is a model that is linked by a many2one relationship from the partner model, it has two fields called name and shortcut, hence you need: ${object.partner_id.title.name} or ${object.partner_id.title.shortcut}

Use the dynamic value builder or check the fields that come from the object and search them up in the interface.If they are a char/int/text and you stop there and if it's another object that you further need to look for subfields and append them to the placeholder

Best,
Paul Catinean

Yes, I noticed the typo when I double checked the field. But that was just after I asked the question here.

Martin T
on 1/13/14, 5:43 PM

Your solution works great for the english e-mail, but unfortunately not for the translated e-mail. I tried to check te box in the dynamic value builder, but then I could not save the form because it was a base field. Do you have any suggestion how I can proceed?

Martin T
on 1/13/14, 5:46 PM

I'm not sure what you mean by that, it is possible that there is no translation available or there's a different template used.Normally though it should do the exact same operation only pass the language in the context and get the translation instead of the original value.You do not get any error or output whatsoever? Give a few more details please

Paul Catinean
on 1/13/14, 5:52 PM

Oke, what i'm trying to say is the following: The $(object.partnerid.title) works in the english template. I got as expected the text "Dear mister ...", but when I open the same template in the Dutch language, I got "Geachte mister...." instead of "geachte dhr ...". So I checked if the object has a dutch translation in the database, and it exists. When I check the field in the dynamic value builder I noticed that there is a checkbox, "translatable" which is not selected by default, when I check marked the box, and try to save it give my an error, cannot save because it's a base field.

Martin T
on 1/15/14, 4:53 PM

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.

Register

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

2 follower(s)

Stats

Asked: 1/13/14, 11:16 AM
Seen: 3165 times
Last updated: 3/16/15, 8:10 AM