<field name="inherit_id">
View的繼承<form>
的繼承
base.view_partner_form
在website之後添加<field name="write_date"/>
欄位<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="website" position="after">
<field name="write_date"/>
</field>
</field>
</record>
<tree>
的繼承
base.view_partner_tree
在email之後添加<field name="phone" position="move"/>
欄位<record id="view_partner_tree" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<field name="email" position="after">
<field name="phone" position="move"/>
</field>
</field>
</record>
<Search>
的繼承
base.view_res_partner_filter
添加到收尋選項最下層<field name="mobile"/>
欄位<record id="view_res_partner_filter" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<xpath expr="." position="inside">
<field name="mobile"/>
</xpath>
</field>
</record>
※<record id="指定的view">
繼承所指定的view不能更改
<tree>
可以加上文字屬性跟顏色<tree decoration-bf="customer_rank >0"
decoration-danger="customer_rank >0 and supplier_rank >0"
decoration-warning ="supplier_rank > 0">
<field name="name"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="state_id" optional="hide"/>
<field name="country_id" optional="show"/>
<field name="customer_rank" invisible="1"/>
<field name="supplier_rank" invisible="1"/>
</tree>
※decoration-bf
為粗體、decoration-danger
顯示紅色、decoration-warning
顯示黃色
<Search>
通常使用三種寫法會在搜尋欄位出現name、category_id、bank_ids來做為搜尋的依據:
<search>
<field name="name"/>
<field name='category_id" filter_domain="[('category_id','child_id','self')]"/>
<field name="bank_ids" widget="many2one"/>
</search>
會在Filters裡面作用,以Suppliers作為過濾的依據:
<search>
<filter name="suppliers" string="Suppliers" domain="[('supplier_rank', '>', 0)]"/>
</search>
會在Group By裡面作用,以Conutry作為分組的依據:
<search>
<group expand="0" string="Group By">
<filter string="Country" name="country" context="{'group_by':'country_id'}"/>
</group>
</search>
<searchpanel>
<field name="user_id" icon="fa fa-users"/>
<field name="category_id" icon="fa fa-list" select="multi"/>
</searchpanel>
form_view_ref
與tree_view_ref
可以指定開啟的view
<field name="context">
{'tree_view_ref':'my_module.tree_all_contants'}
</field>