【问题标题】:Inherit a qweb template (t-name) in odoo 10在odoo 10中继承一个qweb模板(t-name)
【发布时间】:2019-07-25 12:24:27
【问题描述】:

我正在尝试扩展 qweb 模板视图。但它不起作用。 这是我的代码。

my_module/static/src/xml/website.xml

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="website.homepage_editor_welcome_message" >
<t t-jquery=".lead" t-operation="replace">
    <p class="lead second_head">Let's start designing.</p>
</t>
</t>
</templates>    

这是来自website 模块的原始代码。

<div t-name="website.homepage_editor_welcome_message" class="container text-center o_homepage_editor_welcome_message">
    <h2 class="mt0">Welcome to your <b>Homepage</b>!</h2>
    <p class="lead">Let's start designing.</p>
    <div class="o_tooltip_container">Follow all the <div class="o_tooltip bottom"/> signs to get your website ready in no time.</div>
</div>

并在__manifest__.py 中添加 XML 文件,如下所示。

 'qweb': ['static/src/xml/website.xml'],

但网站没有变化。

我该怎么做?

【问题讨论】:

  • 那么,预期的变化是什么?
  • @AjmalJK,我为&lt;p&gt; 标签添加了新类。

标签: odoo odoo-10


【解决方案1】:

我能够找到能够继承使用 t-name 声明的 Qweb 模板的唯一方法是在您的自定义模块中重新定义它,直接更改代码。您将覆盖现有的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-12
    • 1970-01-01
    • 1970-01-01
    • 2021-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多