Odoo Help


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.


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

Kit Sunde
on 11/3/14, 2:45 PM 5,121 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 11/3/14, 2:45 PM
Seen: 5121 times
Last updated: 3/16/15, 8:10 AM