微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试在Odoo 12中覆盖noupdate = 1电子邮件模板

如何解决尝试在Odoo 12中覆盖noupdate = 1电子邮件模板

我正在尝试覆盖基本电子邮件模板(noupdate = 1),但是无法覆盖。另外,搜索我的问题,但没有找到适当的解决方案。

因此,任何人都可以帮助我解决这个问题。

我的代码就像:

<?xml version="1.0" encoding="utf-8"?>

<odoo>
    <data noupdate="0">
        <!-- Email template for reset password -->
        <delete id="auth_signup.reset_password_email" model="mail.template"/>
        <record id="reset_password_email" model="mail.template">
           . . .
        </record>
        <!-- Email template for new users -->
        <delete id="auth_signup.set_password_email" model="mail.template"/>
        <record id="set_password_email" model="mail.template">
            . . .
        </record>
    </data>
</odoo>

创建新用户时出现此错误

ValueError: External ID not found in the system: auth_signup.reset_password_email

预先感谢

解决方法

好吧,您不需要覆盖现有的电子邮件模板。您可能需要一个新的。您也可以删除旧的

<record id="reset_password_email" model="mail.template">
  <field name="name">Auth Signup: Reset Password</field>
  <field name="model_id" ref="base.model_res_users"/>
  <field name="subject">Password reset</field>
  <field name="email_from">"${object.company_id.name | safe}" &lt;${(object.company_id.email or user.email) | safe}&gt;</field>
  <field name="email_to">${object.email_formatted | safe}</field>
  <field name="body_html" type="html">
    <p>whatever email template you want & remember you could use OBJECT AS FOLLOWING</p>
    <span style="font-size: 20px; font-weight: bold;">
      ${object.name}
    </span>
  </field>
  <field name="lang">${object.lang}</field>
  <field name="auto_delete" eval="True"/>
  <field name="user_signature" eval="False"/>
</record>

请注意,您自定义的模板ID为custom_module.reset_password_email,它将替换auth_signup.reset_password_email

或者您可以遵循: Odoo - How to update non updateable records by XML

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。