Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
68 Visualizzazioni

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! 

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
apr 20
5055
1
feb 24
4569
2
apr 25
2307
2
set 25
1808
0
nov 19
3040