In res.config .settings I have a checkbox and a many2one field. When I click on the checkbox, it shows the many2one field. I then select a value for many2one and save. This value is visible in the database.
But when I deselect the checkbox and leave the value in many2one this value from the many2one field is saved in the database.
I would like the value from many2one not to be saved in the database if the checkbox is unchecked.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
1622
Views
Hi Ewdy,
Define an onchange function for your checkbox(boolean field). In that if the check box is not selected, you have to reset the value in the many2one field to False.
Try this:
@api.onchange('your_check_box_field')
def onchange_your_check_box_field(self):
if not self.your_check_box_field:
self.many2one_field = False
Thank you
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Jun 23
|
1542 | ||
|
1
Nov 22
|
1719 | ||
|
2
Apr 21
|
2281 | ||
|
1
Nov 24
|
1487 | ||
|
1
Nov 24
|
1198 |