Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
3519 Переглядів

Hi,

I want to hide edit button, when state changed to done(without putting attrs in each field) 


Аватар
Відмінити
Автор

hii, Sylvain Michel Ratsarafahatra

Thanks for your response, i already try that solution but it's not working for me

Найкраща відповідь

Hi,

I suggest you to do like the bellow code by creating a computed field, adapt it as you need.

# Hide edit button
edit_hide_css = fields.Html(string='CSS', sanitize=False, compute='_compute_edit_hide_css')

@api.depends('state')
def _compute_edit_hide_css(self):
for rec in self:
if rec.state in ['done']:
rec.edit_hide_css = '<style>.o_form_button_edit {display: none !important;}</style>'
else:
rec.edit_hide_css = False

Best regards!

Аватар
Відмінити

that does not prevent a user from re-activating the button with the browser inspector; It should be recommended for permissions.

Найкраща відповідь

Have a look at this module https://odoo-community.org/shop/product/web-action-conditionable-2608#attr=8636, you can set the attribute `edit` base on the value of a field

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
3
вер. 25
3248
0
серп. 25
795
1
серп. 25
3005
2
лип. 25
8628
2
лип. 25
5019