This question has been flagged
1 Reply
10401 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?

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Author

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?

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

Author

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.