在本文中,讓我們看看如何在 Odoo 16 中繼承和編輯現有郵件模板。我們必須這樣做才能對現有模板的內容進行任何調整或更新。讓我們考慮一個在會計模塊中更新郵件模板的示例。
單擊“account.move”模型中的“發送并打印”按鈕后,將打開上述向導。在這里,我們將進行更改。從向導中可以清楚地看到使用的模板名稱是“發票:發送”。讓我們搜索代碼。
<?xml version="1.0" ?>
<odoo><!-- Mail template are declared in a NOUPDATE blockso users can freely customize/delete them --><data noupdate="1"><!--Email template --><record id="email_template_edi_invoice" model="mail.template"><field name="name">Invoice: Sending</field><field name="model_id" ref="account.model_account_move"/><field name="email_from">{{ (object.invoice_user_id.email_formatted or object.company_id.email_formatted or user.email_formatted) }}</field><field name="partner_to">{{ object.partner_id.id }}</field><field name="subject">{{ object.company_id.name }} Invoice (Ref {{ object.name or 'n/a' }})</field><field name="description">Sent to customers with their invoices in attachment</field><field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;"><p style="margin: 0px; padding: 0px; font-size: 13px;">Dear<t t-if="object.partner_id.parent_id"><t t-out="object.partner_id.name or ''">Brandon Freeman</t> (<t t-out="object.partner_id.parent_id.name or ''">Azure Interior</t>),</t><t t-else=""><t t-out="object.partner_id.name or ''">Brandon Freeman</t>,</t><br /><br />Here is your<t t-if="object.name">invoice <span style="font-weight:bold;" t-out="object.name or ''">INV/2021/05/0005</span></t><t t-else="">invoice</t><t t-if="object.invoice_origin">(with reference: <t t-out="object.invoice_origin or '