尝试在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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...