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.

0

What is a proper way to use xpath in OpenERP 7.0 ?

By
Vikram
on 8/24/13, 4:33 AM 3,503 views

Is it necessary to add data tag when we use xpath in OpenERP 7.0 ? Invalid XML Architecture error is coming every time whenever we changes made on that record? Which is the proper way to use Xpath expression?

2

Brett Lehrer

--Brett Lehrer--
1252
| 5 4 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 8/24/13, 7:49 PM

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>

Ok, Why <data> tag used before xpath expression.... Can you explain more?

Vikram
on 8/25/13, 1:53 PM

You should never need to add data tags into xpath expressions. The data tags in view XML files are only used to give the option of adding the noupdate attribute. You could have two sets of data tags, one with some basic records or maybe a sequence that you wouldn't want to revert after installing, so you could use <data noupdate="1"> for that. Then after those tags, use normal <data> tags and put the rest of your views/menus in there. And you're still left with only one root tag, <openerp>.

Brett Lehrer
on 8/25/13, 2:16 PM

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

0 follower(s)

Stats

Asked: 8/24/13, 4:33 AM
Seen: 3503 times
Last updated: 3/16/15, 8:10 AM