Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1636 มุมมอง

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)



อวตาร
ละทิ้ง
ผู้เขียน

Thank you 

it works by your solution

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง

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 ตอบกลับ มุมมอง กิจกรรม
3
ก.ย. 25
2679
0
ส.ค. 25
296
1
ส.ค. 25
2300
2
ก.ค. 25
8121
2
ก.ค. 25
4558