直接上代码,你参考一下吧
<!-- 客户action -->
<record model="ir.actions.act_window" id="archives_common_customer_action_window">
<field name="name">客户</field>
<field name="res_model">archives.customer</field>
<field name="view_mode">tree,form</field>
<!-- 核心 -> domain -->
<field name="domain">[('is_customer', '!=', False)]</field>
<field name="search_view_id" ref="customer_search_view"/>
</record>
<!-- 客户action 绑定treeView -->
<record model="ir.actions.act_window.view" id="archives_common_customer_action_window_tree">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="archives_common_customer_list"/>
<field name="act_window_id" ref="archives_common_customer_action_window"/>
</record>
<!-- 客户action 绑定formView -->
<record model="ir.actions.act_window.view" id="archives_common_customer_action_window_form">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="archives_common_customer_edit"/>
<field name="act_window_id" ref="archives_common_customer_action_window"/>
</record>
<!-- 客户action 绑定menu -->
<menuitem name="客户" id="archives.menu_sale_customer" parent="archives.menu_sale"
action="archives_common_customer_action_window"/>
<!-- 供应商action -->
<record model="ir.actions.act_window" id="archives_common_provider_action_window">
<field name="name">供应商</field>
<field name="res_model">archives.customer</field>
<field name="view_mode">tree,form</field>
<!-- 核心 -> domain -->
<field name="domain">[('is_provider', '!=', False)]</field>
<field name="search_view_id" ref="provider_search_view"/>
</record>
<!-- 供应商action 绑定treeView -->
<record model="ir.actions.act_window.view" id="archives_common_provider_action_window_tree">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="archives_common_provider_list"/>
<field name="act_window_id" ref="archives_common_provider_action_window"/>
</record>
<!-- 供应商action 绑定formView -->
<record model="ir.actions.act_window.view" id="archives_common_provider_action_window_form">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="archives_common_provider_edit"/>
<field name="act_window_id" ref="archives_common_provider_action_window"/>
</record>
<!-- 供应商action 绑定menu -->
<menuitem name="供应商" id="archives.menu_purchase_provider" parent="archives_menu_purchase"
action="archives_common_provider_action_window"/>