Hello all, I ran into an issue where the appointment email sent to the 'customer' appeared as test rather than the name they typed during the registration. Do i need to change the objecct.common_name to something else or is there a way to configure it. I have tried the object.partner_id variable but if I put something like object.partner_id.name, it appears as test. If I use parameters like phone or email, it appears correctly. May I know why does this happen ?
Any suggestions or advice is highly appreciated!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Try with below code for email template Recipient:
Xml code:
<record id="define_email_template" model="mail.template">
<field name="model_id" ref="model_x_name"/>
<field name="email_from">{{ user.email_formatted }}</field>
<field name="body_html" type="html">
<p>Dear <t t-out="ctx.get('Recipient')"/>,
</p>
# Rest contain
</field>
</record>
Python code:
def custom_method(self):
template = self.env.ref('define_email_template')
context = {}
if template:
context.update({
'Recipient': user.name or None, # Replace placeholder with user's name
})
template.write({
'email_to': email,
})
template.with_context(**context).send_mail(self.id, force_send=True)
I figured out the issue. The reason it appeared as test was literally me making the appointment on preview using the company login credentials. I enabled the sign in button on the website, created a test account with my personal email and made an appointment. The email sent to my email now correctly addresses the name of the attendee.
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
3
lut 20
|
3570 | ||
|
1
lis 23
|
2256 | ||
|
0
paź 23
|
1289 | ||
|
1
sty 20
|
7303 | ||
|
0
mar 15
|
4073 |