Odoo Help


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

Kit Sunde
on 11/3/14, 2:45 PM 5,446 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
On 11/15/14, 1:16 AM

Try the code:-

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

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: 5446 times
Last updated: 3/16/15, 8:10 AM