Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1624 Tampilan

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
Buang
Penulis

Thank you 

it works by your solution

Jawaban Terbai

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
Buang

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)

Post Terkait Replies Tampilan Aktivitas
3
Sep 25
2676
0
Agu 25
265
1
Agu 25
2263
2
Jul 25
8113
2
Jul 25
4557