视图中未捕获的TypeError

时间:2017-08-19 17:41:49

标签: xml openerp odoo-10

我正在按照Odoo开发手册中的说明进行查看,当我加载以下视图时,我收到错误Uncaught TypeError: Type is not a constructor。如果我在代码中取出<search>元素(在第11-15行),页面会正确加载。我对<search>代码有什么错误?

<?xml version="1.0"?>
<odoo>
    <record id="view_tree_todo_task" model="ir.ui.view">
        <field name="name">To-do Task Form</field>
        <field name="model">todo.task</field>
        <field name="arch" type="xml">
            <tree decoration-muted="is_done==True">
                <field name="name"/>
                <field name="is_done"/>
            </tree>
            <search>
                <field name="name"/>
                <filter string="Not Done" domain="[('is_done','=',False)]"/>
                <filter string="Done" domain="[('is_done','!=',False)]"/>
            </search>
        </field>
    </record>
    <record id="view_form_todo_task" model="ir.ui.view">
        <field name="name">To-do Task Form</field>
        <field name="model">todo.task</field>
        <field name="arch" type="xml">
            <form string="To-do Task">
                <header>
                    <button class="oe_highlight" name="do_toggle_done" string="Toggle Done" type="object"/>
                    <button name="do_clear_done" string="Clear All Done" type="object"/>
                </header>
                <sheet>
                    <group name="group_top">
                        <group name="group_left">
                            <field name="name"/>
                        </group>
                        <group name="group_right">
                            <field name="is_done"/>
                            <field name="active" readonly="1"/>
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>
</odoo>

1 个答案:

答案 0 :(得分:2)

代码本身(字段,域等)看起来很好。我认为问题可能在于将搜索节点包含在同一视图定义中。通常,搜索视图是单独定义的。

有关如何创建它的更多详细信息,请查看views documentation