+1 vote
25 views

I want to create Outgoing e-mail server. There is a way for doing that from odoo ui. But i want to create e-mail server by defining it as a record in xml. I want it to be defined when module is installed.

like creating an action below :

<odoo>
<data noupdate="0">


    <!-- Action Record -->

    <record id="my_action_id" model="ir.cron">
       <field name="name">Name of Record</field>
       <field name="user_id" ref="base.user_root" />
       <field name="interval_number">1</field>
       <field name="interval_type">days</field>
       <field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 01:00:00')" />
       <field name="numbercall">-1</field>
       <field eval="False" name="doall" />
       <field eval="'my_module.model_name'" name="model" />
       <field eval="'function_name'" name="function" />
      </record></data></odoo>

Is it possible ?

in Server by (10.5k points) | 25 views

1 Answer

+2 votes
Best answer

Hi,

You should create an xml file for your emails like this :

<record id="template_email" model="mail.template">
    <field name="name">Record name</field>
    <field name="subject">Subject of your email</field>
    <field name="model_id" ref="module_name.model_name_of_your_module"/>
    <field name="auto_delete" eval="True"/>
    <field name="email_from">"${user.email|safe}</field>
    <field name="body_html" type="html">  create the body of your email</field></record>

by (3.1k points)
selected by
202 questions
178 answers
34 comments
112,141 users