Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
You're only using xpath on the contents of the arch tags. The root tags should always be /form, /tree, /search, /kanban, etc.
You could also make life a lot easier by just using two slashes then just entering the field you're looking for. Unless you're on a large, complex form with more than one instance of the same field listed, it should be fine. If that's the case, just add in a few extra bare minimum details to the xpath string to find it. So for example, putting "new_field" in place of "original_field":
<xpath expr="//field[@name='original_field']" position="replace"> <field name="new_field"/> </xpath>
@Tangaraj if you mean xpath vs direct tag used when you inherit a view, then xpath has numerous advantage compared to direct tag. In fact, in the implementation of view inheritance direct tags are replaced with xpath, e.g. <field name="field_name" ..> will be search using //field[@name='field_name'] xpath.
Moreover xpath gives you a greater flexibility to pinpoint an element. Within xpath you can use .. to indicate parent element (e.g. in case you need to change the group that contain a certain field but that group does not have attribute that you can use to identify), you can use some positional operator to pinpoin an element (e.g. //field[last()] if you want to pinpoint the last field without having to know what the last field will be), you can pinpoint exactly which field in case if you have multiple fields with the same name (usually happens if you have document header and detail lines in one view). More detailed capability of xpath can be refered to here.
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/23/14, 1:36 AM|
|Seen: 1652 times|
|Last updated: 8/3/15, 8:25 AM|