コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
67 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
4月 20
5055
1
2月 24
4569
2
4月 25
2307
2
9月 25
1808
0
11月 19
3040