跳至内容
菜单
此问题已终结
1 回复
3728 查看

how can we hide the edit button on specific record state for specific user groups.

形象
丢弃
最佳答案


Hi  paidy kumar,

Try,

In Py

x_css = fields.Html(
sanitize=False,
compute='_compute_css',
store=False,
)

def _compute_css(self):
for rec in self:
# To Remove Edit Option
if self.
env.user.has_group('module_name.group_name') and rec.state != 'draft' :
            rec.x_css =''
else:
rec.
x_css = False

In XML


Hope it helps,
Kiran K


形象
丢弃
编写者

your idea awesome...thank you so much you made my day.

编写者

i just changed this line rec.x_css = '<style> .o_form_button_edit {display:None}</style>'

Yea..That's Correct
Missed while copying I guess,

In Py

x_css = fields.Html(
sanitize=False,
compute='_compute_css',
store=False,
)

def _compute_css(self):
for rec in self:
# To Remove Edit Option
if self.env.user.has_group('module_name.group_name') and rec.state != 'draft' :
rec.x_css ='<style>.o_form_button_edit {display: none !important;}</style>'
else:
rec.x_css = False

In XML

<field name="x_css" force_save="1" nolabel="1"/>

相关帖文 回复 查看 活动
2
9月 23
3536
1
12月 22
1936
3
11月 22
4040
1
11月 22
4356
0
2月 22
2199