Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
66 Lượt xem

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! 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 20
5055
1
thg 2 24
4569
2
thg 4 25
2307
2
thg 9 25
1808
0
thg 11 19
3040