我有名为theme_test的基本主题 ,这是模板代码(此模板添加在清单的数据中)。
<template id="product_catg_test" name="Product Category">
<t t-if="categories">
<code for print category>
</t>
</template>
Run Code Online (Sandbox Code Playgroud)
所以我创建了一个名为test_theme_extended的扩展模块,并尝试了两种继承方法来替换t-if条件
<template id="product_catg_test_extended" inherit_id="theme_test.product_catg_test" name="Test">
<xpath expr="//t[@t-if='categories']" position="replace"></xpath>
</template>
Run Code Online (Sandbox Code Playgroud)
第一种方法给了我一个错误
odoo.tools.convert.ParseError:“元素 '' 无法位于父视图中
<t t-extend="theme_test.product_catg_test">
<t t-jquery="t[t-if='categories']" t-operation="replace"/>
</t>
Run Code Online (Sandbox Code Playgroud)
这也行不通。
我认为主视图是从主题创建的,并且没有外部 ID,这就是我面临这个问题的原因。但是如何继承扩展模块中的基本主题视图呢?
odoo-13 ×1