Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email_template_qweb: stop migrating from 17.0 #1480

Open
trisdoan opened this issue Oct 18, 2024 · 3 comments
Open

email_template_qweb: stop migrating from 17.0 #1480

trisdoan opened this issue Oct 18, 2024 · 3 comments

Comments

@trisdoan
Copy link

trisdoan commented Oct 18, 2024

Context

  • email_template_qweb was introduced in https://github.com/OCA/social/pull/55, Odoo was still using Jinja to render email template

  • Starting from Odoo 15.0, Odoo refactored all its mail templates to use qweb instead: https://github.com/odoo/odoo/pull/77377

    • So, with this function, We can actually use t-call to refer ir.ui.view (with inheritance of course)

For those who would like not to use the module:

  1. update their mail templates to type qweb
  2. update body_html to include t-call to the view
@pedrobaeza
Copy link
Member

Thanks for the info. Have you tried to do such t-call and everything is working properly?

@trisdoan
Copy link
Author

Hello @pedrobaeza, yes I did some testing

template

  <template id="test_module.test_template" name="Test Template">
    <div>testing</div>
  </template>

email.template

<record id="test_module.test_mail_template" model="mail.template">
    <field name="name">Test</field>
    <field name="subject">Demo</field>
    <field name="model_id" ref="stock.model_stock_picking"/>
    <field name="email_from">test@com</field>
    <field name="partner_to">test1@com</field>
    <field name="lang">{{ object.partner_id.lang }}</field>
    <field name="body_html" type="html">
      <div>
        <t t-call="test_module.test_template"/>
      </div>
    </field>
  </record>

Result
test_1

Template Inheritance

<template id="test_module.test_template_inherited" name="Test Template Inherited" inherit_id="test_module.test_template">
    <xpath expr="//div" position="inside">
      <div>
        <span> testing 2</span>
      </div>
    </xpath>
</template>

Result
test_2

@pedrobaeza
Copy link
Member

Great, thanks for confirming! Then indeed the module is no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants