Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
69 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
1
avr. 20
5055
1
févr. 24
4569
2
avr. 25
2307
2
sept. 25
1808
0
nov. 19
3040