Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
51 Представления

As ODOO sends an email to the partner and all followers of the sales order, it confusion the customers as the followers are not listed, every one recieves and email and thinks it is only sent to them. 


I want to make it clear that the email is sent to

  • Partner name and email (as set on the sales order header)
  • All followers (listed by name and email address)

I was able to get the following in the email template but it is not giving me the result i'm looking for; 


<p><strong>Followers:</strong> 

<t t-foreach="object.message_follower_ids" t-as="follower">

    <t t-esc="follower.partner_id.name"/> &lt;<t t-esc="follower.partner_id.email"/>&gt;; 

</t>

</p>

I see a lot of post about the same but did not find the solution.

Hope someone can help! 

Аватар
Отменить
Лучший ответ

Hi,

In Odoo email templates, your code didn’t work as expected because message_follower_ids points to mail.followers, not partners directly. The correct way is to map them to their partners.


Try the following code:


<p><strong>Sent To:</strong><br/>

Partner: <t t-esc="object.partner_id.name"/> &lt;<t t-esc="object.partner_id.email or ''"/>&gt;

</p>


<p><strong>Followers:</strong><br/>

<t t-foreach="object.message_follower_ids.mapped('partner_id')" t-as="follower">

    <t t-esc="follower.name"/> &lt;<t t-esc="follower.email or ''"/>&gt;<br/>

</t>

</p>


Or


<p><strong>Partner:</strong> <t t-esc="object.partner_id.name"/> &lt;<t t-esc="object.partner_id.email or ''"/>&gt;</p>

<p><strong>Followers:</strong><br/>

<t t-foreach="object.message_follower_ids.mapped('partner_id')" t-as="follower">

    <t t-esc="follower.name"/> &lt;<t t-esc="follower.email or ''"/>&gt;<br/>

</t>

</p>


Hope it helps

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
апр. 20
5055
1
февр. 24
4568
2
апр. 25
2307
2
сент. 25
1806
0
нояб. 19
3038