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

do to make a field readonly using one2many field?

By
willie ho
on 2/2/15, 12:57 AM 683 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

e.g.

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

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

 

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
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')]}" />

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