Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2528 Vistas

Good morning, I want a list of followers (email address) to be added at the beginning of every email coming from odoo, regardless of whether it is an internal user or not.
I found this code,

% for follower in object.message_follower_ids:

${follower.name} ${follower.email}

% endfor


 but I can't add it to the email template. Can anyone suggest how to get it?
I cannot modify files (enterprise version), only settings possible from the backend.

Avatar
Descartar
Mejor respuesta

check the below steps:

  1. In your any_think method, you are defining data as an empty dictionary. Then, you're assigning the result of self.read()[0] to data['form']. This implies that you want to pass the form data to the report. Make sure the read() method is returning the expected values. You can add some print statements to check the data['form'] before passing it to the report.

  2. The line return self.env.ref('nidal.wizreport').report_action(self, data=data) suggests that you have defined a report template with the XML ID 'nidal.wizreport'. Confirm that the XML ID is correct and that the report template exists. Also, check the report template to ensure it is properly configured to handle the data passed through the data variable.

  3. In the XML view of your wizard, the id attribute is missing for the field elements. Make sure to provide unique IDs for each field, as they are necessary for proper functioning and data binding.

  4. Check the report design and the report template associated with the XML ID 'nidal.wizreport'. Verify that the report template is correctly defined and that it handles the data passed through the data variable. Make sure you are using the correct placeholders and syntax to display the data in the report.


Avatar
Descartar
Mejor respuesta

Hi,

You can create a custom template in the xml file 










<?xml version="1.0" encoding="UTF-8"?>
<odoo>
        <record id="template_id" model="mail.template">
            <field name="name">Template name</field>
            <field name="model_id" ref="module_name.model_model_name"/>
            <field name="auto_delete" eval="False"/>
            <field name="email_from">{{ (object.env.user.login) }}</field>
            <field name="subject">Type your own subject</field>
            <field name="body_html">
                <![CDATA[
               <p>
               //Write your email details
               </p>
               ]]>
            </field>
        </record>
</odoo>



mail_template = self.env.ref(module_name.tempalte_id)
mail_template.send_mail(self
.id, force_send=True,email_values={
                             
'email_to':// email address})


If you have multiple people you can create it has in loop statements

Hope it helps

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
dic 24
1003
1
ene 23
2677
1
mar 21
3248
1
oct 20
4298
4
jul 17
7256