Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3821 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất


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


Ảnh đại diện
Huỷ bỏ
Tác giả

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

Tác giả

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"/>

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 23
3665
1
thg 12 22
2032
3
thg 11 22
4193
1
thg 11 22
4492
0
thg 2 22
2272