There is a module called enh_customs that we use to add/edit/remove base odoo module fields. Use this module to edit any of the base modules using xpath expressions.



Example:

<xpath expr="//field[@name='analytic_account_id']" position="after">
    <field name="county_id"/>
</xpath>


Xpath

Add some attributes to node

Code:

<xpath expr="//some/xpath" position="attributes">    <attribute name="some_field">
</xpath>

Qweb expression:

<attribute name="t-att-another_field">website.get_another_field_value()</attribute>

After rendering it becomes regular attribute:

<.... another_field="value" ...>

Important

Inside of

<xpath expr="//some/xpath" position="attributes">    ...
</xpath>

you can put only <attribute name= and nothing more.

To test xpath

Code:

#Odoo tip - XPath playground: $ sudo apt-get install libxml-xpath-perl $ xpath -e "//record[@id=',,,']" -e "//field[@name='...']" *.xml