Hello,
I just need to take out the other from the gender selection.
Can anyone assist?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I just need to take out the other from the gender selection.
Can anyone assist?
You just overwrite that fields like
gender = fields.Selection([
('male', 'Male'),
('female', 'Female'),
])
please follow https://www.odoo.com/documentation/12.0/developer/reference/orm.html#odoo.fields.Text
Thanks Farid, but the issue is where to do this overriding
Hi,
You need to modify the field definition in the relevant model.
1: Identify the model and field that need to be modified. Example There is a
selection field inside ‘hr.employee’ ‘gender’ inside ‘hr.employee’.
2: Edit the selection parameter by Inheriting ‘hr.employee’. Here’s an example
from odoo import fields,models
classEmployeeSelectionInherit(model.Model):
_inherit=’hr.employee’
gender =fields.Selection([ ('male', 'Male'), ('female', 'Female'), ],string='Gender')
In this Custom Module We removed the “other” option from ‘gender’ field
inside ‘hr.employee’.
3: Update the Module and Apply Changes.
After this ‘other’ should be not seen in hr.employee.
Regards
Please, how can i do that using Odoo studio ?
you can explan to me with pictures
Thanks a lot !
gender = fields.Selection(selection='get_gender',string="Gender")
@api.model
def get_gender(self):
return [
('male', 'Male'),
('female', 'Female')
]
In an app, you need a python file, e.g. employee.py:
from odoo import models, fields
class Employee(models.Model):
_inherit = 'hr.employee'
gender = fields.Selection(selection=[('male', 'Male'), ('female', 'Female')])
This code will override the gender selection of 'hr.employee' model.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.