Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


xpath - how to replace attributes only and not the full field? [Closed]

Michael Karrer
on 12/3/13, 6:15 AM 14,911 views

The Question has been closed

Serpent Consulting Services Pvt. Ltd.
on 12/04/2013 00:38:08

Is it possible to only replace the attributes of an xml field in an xml view but not the full field?


<page string="Contacts" attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}" autofocus="autofocus">

All i want to change is the

attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}"



without replacing the full page field and all of its content!

So the problem is that i only know how to replace the full <page> filed with all of its content - so i would have to copy and paste all of the content of the page field to my new inherited view also - not a good way for me!

So is there a way to only change the attributes of a field (xml node) through an inherited view?


Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 12/3/13, 7:18 AM

Hello Michael,

There is a attributes value in position which allows you to change/replace the value of the attribute.

Try this:

<xpath expr="//page[@string='Contacts']" position="attributes">
    <attribute name="attrs">{}</attribute>


Serpent Consulting Services

Just a sidenote: Since V9 @string has been depracated and you should now use @name.

on 8/19/16, 3:39 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 12/3/13, 6:15 AM
Seen: 14911 times
Last updated: 8/30/16, 10:03 AM