Odoo Help

1

How tow solve this error: "View inheritance may not use attribute 'string' as a selector."

By
Tatorus
on 2/23/16, 9:06 AM 7,364 views

When i try to load my module on my odoo server, i've this :

Error details:
View inheritance may not use attribute 'string' as a selector.


I'm pratically sure it comes from this line, maybe because of the string but i don't know how to solve it :

<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" position="before">


since v9, it recommanded to not use string in xpath. Because translation is sonde, before inheritage.
So if you was doing xpath expr=@string='Set to Draft', you should replace it by @name='action_cancel_draft' eg...

Jérémy Kersten (jke)
on 2/23/16, 9:43 AM

Ok but in my view, i don't use a xpath

Tatorus
on 2/23/16, 9:47 AM

keep just ''' button name="action_cancel_draft" position="before" '''

Jérémy Kersten (jke)
on 2/23/16, 10:53 AM

Still the same error

Tatorus
on 2/24/16, 3:15 AM

My bad, now i have this error : ParseError: "Invalid view definition Error details: Element '

Tatorus
on 2/24/16, 3:50 AM

@Samer Al-Sarhan I don't use xpath in my view file code @vitzoteck Same than before, i don't use xpath

Tatorus
on 2/24/16, 10:05 AM
1
Tatorus
On 2/25/16, 8:49 AM

I replaced this :

<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" position="before">

by :

<xpath expr="/form/header/button[@name='button_draft']" position="before">

I'm not sure if it works well but there is no more error now.

2

Hello, Gays I am also facing the same problem. 

But I find proper solution for XPATH Problem

Odoo V9 do not use string selector for adding the page by XPath. 


like.

you should always use name selector place of string selector.


<xpath expr="//page[@name='report']" position="after">


but this selector are applicable only for that page which has name selector


like.

<page name="report" string="Report Configuration">

But if you want to add a page or a field after or inside page that page does not have name selector.


like.


<page string="Order Lines">

In this condition, you have to use.


<xpath expr="//page[1]" position="after">

so on ...

1,2,3... based on page number  


<xpath expr="//page[2]" position="after">

I think this will help you to solve the XPath problem in Odoo V9.

Thank you for this explanation. Any clue why they use 1 for the first page instead of 0, as it is common practice for arrays?

Nicolas de Moreau
on 5/13/18, 3:33 PM
0
Stephan Becker
On 8/1/18, 5:44 AM

Old Post but great help!!
I very much appreaciate help or questions that are followed by small code snippets how the actual solution looks like...

In my case, I liked to add a new notebook page right behind the 1st (Order LInes).
Guess that one is a pretty common situation.
Just copy paste of the snippet solved that on for me.
Thumbs Up!

0
Samer Al-Sarhan
On 2/23/16, 2:25 PM

the problem not from the mentioned code you probably using xpath to access a location inside an inherited view, and in your xpath your depending on @string , which is not allowed

-1

hi,

I got the same error while migrating one customized module from odoo version 8 to odoo version 9.because in 8 i used <xpath expr="//notebook/page[@string='Information']" position="after"> like  i solve this with replacing     <xpath expr="//notebook[last()]" position="inside">

definately you should use notebook  in view   may be,

if you need help conatct:- virzoteck@gmail.com

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

Question tools

0 follower(s)

Stats

Asked: 2/23/16, 9:06 AM
Seen: 7364 times
Last updated: 8/1/18, 5:44 AM