如何在v8中的openerp(odoo)中创建树视图?

时间:2015-07-22 09:09:00

标签: python openerp odoo openerp-7 odoo-8

我创建了一个包含表单,树视图,操作和菜单的模块。但我的树视图没有显示,也没有更多的错误。我的代码如下。

<record model="ir.ui.view" id="enquiry_form_view_leads">
        <field name="name">Enquiry - Leads Form</field>
        <field name="model">enquiry.lead</field>
        <field name="arch" type="xml">
            <form string="Enquiry Leads Form">
                <sheet>
                    <div class="oe_title">
                        <label for="name" class="oe_edit_only" />
                        <h1>
                            <field name="name" placeholder="Describe the lead..." />
                        </h1>
                    </div> .....
                </sheet>
            </form>
        </field>
</record>  <!-- is working well -->

<!-- Enquiry Lead Tree View  is not working-->
<record model="ir.ui.view" id="enquiry_tree_view_leads">
        <field name="name">Enquiry Leads</field>
        <field name="model">enquiry.lead</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
           <tree string="Enquiry Leads">
                <field name="create_date"/>
                <field name="name"/>
                <field name="contact_name"/>
                <field name="country_id"/>
                <field name="email_from"/>
                <field name="phone"/>
            </tree>
        </field>
    </record>   <!-- is not working -->

<record model="ir.actions.act_window" id="enquiry_case_leads_all">
    <field name="name">Enquiry Leads</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">enquiry.lead</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="enquiry_tree_view_leads"/>
    <field name="view_mode">tree,form</field>
    <field name="help" type="html">
        <p>
            Enquiry leads from website contact us form
        </p>
    </field>    
</record>  <!-- is working well -->

<menuitem name="Enquiry Leads" id="menu_enquiry_leads" parent="base.menu_sales" sequence="0"
        action="enquiry_case_leads_all"/>  <!-- is working well -->

除了我的树视图外,所有其他视图操作都运行良好。请帮帮我..

1 个答案:

答案 0 :(得分:2)

在我构建树的所有时间里,我从来没有添加此行account_invoice_view.xml,也许您可​​以尝试删除它,保存更改并重新启动服务器。 (PD:您可以查看to_sym文件以获取更多帮助。)

我真的希望这可以帮到你!