Odoo Help

Welcome!

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.

4

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>

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/23/14, 1:50 AM

@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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 12/23/14, 1:36 AM
Seen: 1086 times
Last updated: 8/3/15, 8:25 AM