add a new "merge_attributes" extension point to view inheritance system

Registered by Raphaël Valyi - http://www.akretion.com on 2009-09-24

Currently, there are 3 view extension points, "before", "after" and "replace" a given XML element of inherited view, for instance:
        <field name="arch" type="xml">
            <field name="invoiced" position="after">
                <field name="price_type"/>
            </field>
        </field>

However, often we would like to extend an existing view simply to change/extend some attributes of some inherited XML element. For instance:
- change on on_change signature to pass more parameters because we redefined/overrided the on_change method
- change some "attrs" attribute, for instance to change the condition to display/hide or make mandatory or not the element/field
- change the color of tree elements
- change an existing list view to editable or not

In the last 2 cases: "change the color of tree elements" and "change an existing list view to editable or not", this is currently very annoying to achieve. Why, because your can only do this be using replace and redefine the whole tree XML.
This is very weak toward future changes/bug fixes in the original XML, duplicate code and could even not work properly anymore when several extensions tries to alter the original tree XML.

That's why I suggest we add a new anchor called "merge_attribute". We would use it like:
        <field name="arch" type="xml">
            <field name="move_ids" position="merge_attributes" colors="grey:not active" editable="top" />
        </field>

This would simply alter the orginal move_ids element and define/redefine the defined attributes here ("colors" and "editable"), keeping the other original attributes not defined here unchanged.

A very good example of module that would benefit from that is the mrp_prodlot_autosplit module to manage unique serial numbers (extra addons). Indeed it's much better displaying moves in editable lists but we currently don't do it everywhere because that would not integrate properly with lot's of module trying to extend to move list too.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 6.0
Started by
Raphaël Valyi - http://www.akretion.com on 2010-06-18
Completed by
Raphaël Valyi - http://www.akretion.com on 2010-06-18

Sprints

Whiteboard

NB: a hugly workaround meanwhile: http://www.openobject.com/forum/viewtopic.php?p=45668#45668

Good progress, see related branch https://code.launchpad.net/~openobject-training/+junk/server

All right, I consider this done, see for example the position="attributes" in trunk addons crm/crm_installer_view.xml

(?)

Work Items