Odoo Help


do to make a field readonly using one2many field?

willie ho
on 2/2/15, 12:57 AM 1,233 views

I made 2 fields, one is many2one field and the other one is char field

how to use many2one field to make other field readonly


<field name="b" attrs="{'readonly':[('a.type','==','car')]}" />

I tried this but it says there is no field called a.type





| 5 3 6
Jakarta, Indonesia
On 2/2/15, 1:57 AM

Define a related field to propagate the 'type' information of a to the parent model (in my example field type_of_a), and then include that field in the view and use that field in the attrs domain.

<field name="type_of_a" invisible="1"/>

<field name="b" attrs="{'readonly':[('type_of_a','==','car')]}" />

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/2/15, 12:57 AM
Seen: 1233 times
Last updated: 3/16/15, 8:10 AM