Odoo Help


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

on 2/23/16, 9:06 AM 4,774 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

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

on 2/24/16, 3:15 AM

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

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

on 2/24/16, 10:05 AM
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.

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


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. 


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


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


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



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.


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

1 follower(s)


Asked: 2/23/16, 9:06 AM
Seen: 4774 times
Last updated: 2/2/17, 1:27 AM