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

Odoo 9: Issue in View Inheritence [xpath]

By
deep
on 5/6/16, 2:20 AM 455 views

Using Odoo 9 Community Version.

In the inherited view am trying to locate a page using its string attribute however I ended up facing the below error.


"view inheritance may not use attribute 'string' as a selector"



Upon close search I have realized, in Odoo 9, xpath expression doesn't seem to search based on string, then what is the alternative way to achieve the same.


Thanks


2

Yenthe

--Yenthe--
6676
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 5/6/16, 2:34 AM

Hi Deep,

Searching on the string attribute has been deprecated in Odoo 9, it was available in Odoo 8 though.
There are quite some alternatives to this. The first is to xpath by the field name:

<xpath expr="//field[@name='fieldName']" position="replace">

The second option is to do this by index, which is slightly worse since it has a bigger chance that the index of the item will change on some point (if you install / de-install modules):

<xpath expr="//group[1]" position="replace">

The above will get the second group that is in the current view (index starts counting from 0)

Yenthe

Hmmm. yes even I went with indexing which is not a good idea. wonder why did they do this :( anyways thanks:)

deep
on 5/6/16, 3:38 AM

I remember Olivier Dony telling that it was error prone and could cause issues, that is why they removed it. Try to never go with indexing though, it changes too easily and breaks things. Always try to go by name. And more than welcome :)

Yenthe
on 5/6/16, 3:54 AM

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: 5/6/16, 2:20 AM
Seen: 455 times
Last updated: 5/6/16, 3:38 AM