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

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ย. 23
3720
1
ธ.ค. 22
2076
odoo 13: inverse name in comodel แก้ไขแล้ว
3
พ.ย. 22
4246
1
พ.ย. 22
4530
0
ก.พ. 22
2303