Odoo Help


I unable to change the readonly proprety of a button from within fields_view_get method

Tarek Mohamed Ibrahim
on 8/8/15, 7:04 AM 986 views

I received the answer of this question and the suggested solution worked with me. I think the reason because that there is a fields dictionary in the res dictionary. 

Now, as my last comment there, I needed to change the readonly property of the button 'Split' to 'True' by adding the following loop in the fields_view_get method:

nodes = doc.xpath("//button[@string='Split']")
for node in nodes:

I traced the code and the last line was traversed, but the button on the screen was still active.

Any help is appreciated.



You can achieve as like below.

doc = etree.fromstring(res['arch']) 
nodes = doc.xpath("//buttons")
for node in nodes:
    if node.attrib['string'] == 'Split':
        node.attrib['readonly'] = '1'
        setup_modifiers(node, {})

res['arch'] = etree.tostring(doc)

I hope it will help you.


thx for help, this has worked.

Tarek Mohamed Ibrahim
on 8/12/15, 3:20 AM

It's good to hear !

Emipro Technologies Pvt. Ltd.
on 8/12/15, 3:31 AM

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: 8/8/15, 7:04 AM
Seen: 986 times
Last updated: 8/12/15, 3:16 AM