Odoo Help


How can I make a field required if there are m2m relations?

Kit Sunde
on 11/3/14, 2:45 PM 5,225 views

I tried doing this:

<field name="allergy_verification" attrs="{'required': [('allergy_ids', '!=', [])]}" />

However if allergy_ids is blank, then allergy_verification is still marked as required. What am I doing wrong?

Jairo Llopis
On 12/11/14, 5:23 AM

See https://github.com/odoo/odoo/issues/674

<field name="allergy_verification" attrs="{'required': [('allergy_ids', '!=', [[6, False, []]])]}" />

Cool beans, thanks.

Kit Sunde
on 12/11/14, 5:28 AM


| 5 4 7
Bikaner, India

OpenERP Devloper at SunARC Technology

On 11/15/14, 1:16 AM

Try the code:-

<field name="allergy_verification" attrs="{'required': [('allergy_ids', '!=', False)]}" />

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 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: 11/3/14, 2:45 PM
Seen: 5225 times
Last updated: 3/16/15, 8:10 AM