Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
9 Odpowiedzi
21680 Widoki

I'm trying to get the name of the contact in the introduction of my email ( mass mailing) and i don't really know how to.

I tried like that : But it doesn't do anything.

  1. Dear ${mail.mass_mailing.contact},

I'm using Odoo 10


Thank you for your help

Awatar
Odrzuć
Najlepsza odpowiedź

To render the contact name you need to use the mako expressions '${expr}' in the mail,

When 

1. the Recipients type is Customer (fields of res.partner)

${object.name}

2.  the Recipients type is Applicant (fields of hr.applicant)

${object.partner_name}

3.  the Recipients type is Leads / Opportunities (fields of crm.lead) 

${object.partner_name}
or
${object.contact_name}
 

4.  the Recipients type is Mailing List (fields of mail.mass_mailing.contact)

${object.name}


Please Note: when you send the test email it is not rending the mako expressions. 



Awatar
Odrzuć

Hi Atul, I have tried all the ways in Odoo 16. Nothing is working. Is this solution still works perfectly?

Najlepsza odpowiedź

It took me a while to figure out how to do this in Odoo 17 due to the outdated and misleading information available. That's why I want to share the correct method:

Simply use "/" within the body of your Mass Mail, and a new menu will open. Scroll down to the very bottom of the options and select "Dynamic Placeholder." Here, you can choose the value you want to display and optionally add a default value.

That's it. It's quite easy once you know what to do.

Awatar
Odrzuć
Najlepsza odpowiedź

To Reference an Object in a mailing template use QWeb tags 

For Name in a Mailing use this placeholder

t t-out="object.name">Name /t
Awatar
Odrzuć
Najlepsza odpowiedź

With odoo15 to personalize emails, you should use :

  • in subject, expression like : {{ object.name }}
  • in mail body, code like :  

 t-out="object.title.name or ''" contenteditable="false" data-oe-t-inline="true">

 t-out="object.lastname or ''" contenteditable="false" data-oe-t-inline="true">

in t xml tag

firstname and lastname are possible fields after installing the OCA module partner_firstname. To insert this code, you have to edit code source of your email (inside html field or with the inspect function of your web navigator) 


Awatar
Odrzuć
Najlepsza odpowiedź

Can anyone help how to use company name??

Awatar
Odrzuć
Najlepsza odpowiedź

@Dom, you can include just the first name in the mail using ${object.name.split(' ')[0]}

(I can't claim credit for this as I just altered the solution for dates from here (https://www.odoo.com/forum/help-1/question/how-to-change-email-templates-date-format-15885)


Awatar
Odrzuć
Najlepsza odpowiedź

hi there, 

is it also possible to just take the first name into the mass mail?

Awatar
Odrzuć
Najlepsza odpowiedź

You should use 'object'. This object is a reference to a recipient model. When recipients are customers, try just:

${object.name}

Otherwise, depending on related recipients models. e.g. for leads/opportunities (you may find exact field name in developer mode, while just point on this field):

${object.contact_name}


Awatar
Odrzuć
Najlepsza odpowiedź

I have also the same problem.I have checked in developer mode the name of the field and it is "name". I have modified a mass mailing template and used ${object.name} but instead of the customer name, it is {object.name} that appears in the email.  Could anyone help ?

Regards,

Philippe

Awatar
Odrzuć

@Cornette my answer will help you! :)

i have the same problem

Powiązane posty Odpowiedzi Widoki Czynność
2
lis 19
4091
3
cze 17
1380
0
sie 23
1849
0
lip 25
929
1
mar 24
2162