Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
1643 Prikazi

Hello every one

I try to remove one option from selection field by redefine filed without unwanted option, but it is still visible

stander code :

gender = fields.Selection([
('male', 'Male'),
('female', 'Female'),
('other', 'Other')], groups="hr.group_hr_user", tracking=True)

custom code :

gender = fields.Selection([
('male', 'Male'),
('female', 'Female'),
], tracking=True)



Avatar
Opusti
Avtor

Thank you 

it works by your solution

Best Answer

Hello EsDev,

Hope you are doing well.

If you want to remove any option from selection field then you have to override that selection field and rewrite like below.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Opusti

class HrEmployeePrivate(models.Model):
_inherit = 'hr.employee'

@api.model
def get_gender_selection(self):
return [('male', 'Male'), ('female', 'Female')]

gender = fields.Selection(get_gender_selection, tracking=True)

Related Posts Odgovori Prikazi Aktivnost
3
sep. 25
2692
0
avg. 25
303
1
avg. 25
2308
2
jul. 25
8129
2
jul. 25
4565