首页 文章

Odoo 9 qweb继承

提问于
浏览
-1

在机会看板视图中我想删除某些元素 . 它是web_kanban模板中的 Span ,t-name = "Kanban.Group" . 我按照这个帖子How to inherit a template with no ID in Odoo?和相关文档 .

我把它

<t t-extend="KanbanView.Group">
    <t t-jquery="span.o_kanban_config" t-operation="replace"></t>
</t>

在机会kanban模板,我也使它成为一个单独的xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <template>
        <t t-extend="KanbanView.Group">
            <t t-jquery="span.o_kanban_config" t-operation="replace"></t>
        </t>
    </template>
</odoo>

(在这种情况下,我将其名称附加到模块的清单 - 在'qweb'列表中) . 这些方法都不起作用 .

与我读到的关于模板继承的内容相反,我也尝试使用 <t t-extend="web_kanban.template"> ,以防万一Odoo需要模块名称就像继承经典视图一样...

我做错了什么或错过了什么吗?是否有更好/更合适的方式来更新模板?


解决了

最后它有效 .

我创建了一个单独的xml . 当我决定使用折叠箭头时,我将此代码放入其中:

<template>
    <t t-extend="KanbanView.Group">
        <t t-jquery=".o_kanban_config.dropdown" t-operation="inner">
                <a class="o_kanban_toggle_fold" href="#"><i class="fa fa-arrows-h"/></a>
        </t>
    </t>
</template>

我在 openerp .py清单中添加了一个声明:

'qweb':[
    'views/updated_kanban.xml',
],

现在只显示折叠箭头,没有其他选项(编辑,复制等) .

1 回答

  • 0

    OInherting Kanban是 regular 视图,必须像常规视图继承一样继承,this link是看板视图继承的示例 . 看板视图包含qweb但不是实际的qWeb模板,请按照view inheritance document here

相关问题