Reputation: 7341
I'm following the instructions in an Odoo development book for making a view, and I'm getting the error Uncaught TypeError: Type is not a constructor
when I load the following view. If I take out the <search>
element in my code (on lines 11-15), the page loads correctly. What do I have wrong about the <search>
tag?
<?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>
Upvotes: 0
Views: 1137
Reputation: 2135
The code itself (fields, domain, etc.) look fine. I think the problem may be with including the search node in the same view definition. Typically the search view is defined separately.
Take a look at the views documentation for more details on how to create it.
Upvotes: 2