コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1645 ビュー

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)

関連投稿 返信 ビュー 活動
3
9月 25
2706
0
8月 25
310
1
8月 25
2319
2
7月 25
8132
2
7月 25
4569