I am using Odoo13. I have some checkbox (boolean fields).
x= fields.Boolean(string='x')
y= fields.Boolean(string='y')
z= fields.Boolean(string='z')
Now I need to create data but I need minimum 1 boolean fields required.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I am using Odoo13. I have some checkbox (boolean fields).
x= fields.Boolean(string='x')
y= fields.Boolean(string='y')
z= fields.Boolean(string='z')
Now I need to create data but I need minimum 1 boolean fields required.
Inside the create function of your model.
@api.model
def create(self, vals):
if vals['x'] == False and vals['y'] == False and vals['z'] == False:
raise UserError("Minimum one required.")
res = super(OpAdmission, self).create(vals)
return res
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Nov 19
|
12363 | ||
|
4
May 24
|
10062 | ||
|
1
Apr 24
|
1560 | ||
|
0
Nov 23
|
523 | ||
|
1
Sep 23
|
560 |
Thanks a lot. It works.