Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1639 Vistas

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
Descartar
Autor

Thank you 

it works by your solution

Mejor respuesta

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
Descartar

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)

Publicaciones relacionadas Respuestas Vistas Actividad
3
sept 25
2684
0
ago 25
298
1
ago 25
2303
2
jul 25
8124
2
jul 25
4563