コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3490 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
3
9月 25
3192
0
8月 25
753
1
8月 25
2956
2
7月 25
8584
2
7月 25
4986