You are here: Home OpenERP Views Inheritance in Views
Search
Advanced Search…
E-Mail

Webmail: webmail.wyden.com

E-Mail Preferences: postfix.wyden.com/users

E-Mail Administration: postfix.wyden.com

Statistics
Total: 473
Total Pages: 286
Total Folders: 87
Total Files: 18
Total Links: 26
Last modification: 19.04.2012 15:21
 

Inheritance in Views

by Wyden Silvan last modified 28.10.2009 21:50

When you create and inherit objects in some custom or specific modules, it is better to inherit (than to replace) from an existing view to add/modify/delete some fields and preserve the others.

Example: 
<record model="ir.ui.view" id="view_partner_form">
    <field name="name">res.partner.form.inherit</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
    <field name="arch" type="xml">
         <notebook position="inside">
             <page string="Relations">
                   <field name="relation_ids" colspan="4" nolabel="1"/>
             </page>
         </notebook>
    </field>
</record>

The inheritance engine will parse the existing view and search for the the root nodes of

<field name="arch" type="xml">

It will append or edit the content of this tag. If this tag has some attributes, it will look for the matching node, including the same attributes (unless position).

This will add a page to the notebook of the res.partner.form view in the base module.

You can use these values in the position attribute:

  • inside (default): your values will be appended inside this tag
  • after: add the content after this tag
  • before: add the content before this tag
  • replace: replace the content of the tag.