Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3536 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore


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


Avatar
Abbandona
Autore

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

Autore

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

Post correlati Risposte Visualizzazioni Attività
2
set 23
3299
1
dic 22
1750
3
nov 22
3749
1
nov 22
4112
0
feb 22
2076