Skip to Content
Menu
This question has been flagged
2 Replies
4658 Views

 When ticket is created in HelpDesk module the email confirmation is always sent in French 

I would like the emails to be sent in  a language according to the settings of the clients who requested the ticket if the client exists in Odoo, or French if not found in the system 


                                                    

                                                

Avatar
Discard
Best Answer

Hi,

try to configure language of the email template (Ticket: Reception Acknowledgment?). It should be:

${object.sudo().partner_id.lang}

Take into account that all other recipients (if they exists) would also receive this message in a partner language.

UPDATE

To construct complex structure, you should learn a little Mako: https://docs.makotemplates.org/en/latest/syntax.html

In your case it should be something like (not tested):

% if  object.sudo().partner_id.lang  ${object.sudo().partner_id.lang} % endif   % if  not object.sudo().partner_id.lang fr_CA % endif

Or use Python inside like:

${object.sudo().partner_id.lang and object.sudo().partner_id.lang or "fr_CA"}
Avatar
Discard
Author Best Answer

Thanks for the answer it was really useful... One more thing to ask if for example language doesn't exist for this particular user given the fact that it's his first time he is sending an email for ticket creation and  object.sudo().partner_id.lang null or false Odoo would take some specific language like fr_CA for instance

Something like this?

If (object.sudo().partner_id.lang == true) 
    object.sudo().partner_id.lang
else

    "fr_CA"

UPDATE

% if  object.sudo().partner_id.lang  ${object.sudo().partner_id.lang} % endif   % if  not object.sudo().partner_id.lang fr_CA % endif


But you can not really put this into field Language of a template right?

Avatar
Discard

look at the initial answer update. In case it solves your problem, please accept the answer to close the issue.

as for the update: yes, this should be put only inside the body of template. I just mean the logic of conditions in Mako. However, the Python expression might be put