【问题标题】:How can I make a function that sends a custom email in odoo如何制作在 odoo 中发送自定义电子邮件的功能
【发布时间】:2021-08-23 13:54:25
【问题描述】:

其实我有我的自定义模板

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="as_email_template" model="mail.template">
            <field name="name">EMAIL TEMPLATE</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="auto_delete" eval="True"/>
            <field name="email_from">${(object.res_user_id.email}</field>
            <field name="email_to">${object.client_name.email}</field>
            <!-- <field name="report_template" ref="action_example_pdf"/> -->
            <field name="subject">lolla</field>
            <field name="body_html">
                Hello this is a test from odoo
            </field>
        </record>
    </data>
</odoo>

我想从 odoo 发送一个名为 action_confirm 的本机函数

@api.multi
def action_confirm(self):
    res= super(AsSaleOrder, self).action_confirm()
    return res

但我不知道如何制作发送自定义电子邮件模板的功能。

【问题讨论】:

    标签: python odoo-12


    【解决方案1】:

    您可以使用此结构发送带有自定义模板的邮件。

    template = self.env.ref('your_module_name.as_email_template', False)
    template.send_mail(self.id)
    

    【讨论】:

      猜你喜欢
      • 2019-04-20
      • 2022-07-04
      • 1970-01-01
      • 1970-01-01
      • 2016-09-16
      • 2014-11-30
      • 2021-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多