Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1646 Zobrazení

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
Zrušit
Autor

Thank you 

it works by your solution

Nejlepší odpověď

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
Zrušit

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 Odpovědi Zobrazení Aktivita
3
zář 25
2709
0
srp 25
313
1
srp 25
2322
2
čvc 25
8135
2
čvc 25
4574