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

Hello Odoo team,

I had the problem related invisible the button that I want, is there a way to hide the button by the permission?

Is it able to do without the customize XML code?

Thank you for the help


Ảnh đại diện
Huỷ bỏ

Hi,

You mean create button or any button in inside of the form ?

Câu trả lời hay nhất

Hi, 

 You can hide the button in different ways.

1.restricting visibility of the button by  groups     

<button string="Send Report" type="object" name="action_name" states="inprogress,done" groups="base.group_no_one"/>


2.Based on different conditions    <button string="Sign Directly" name="sign_directly" type="object" class="btn-primary" attrs="{'invisible': [('is_user_signer', '=', False)]}"/>
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

1. Hiding Create, Edit, Remove Button

If you mean Create button, then you can hide it without changing your XML Code like below code

Assign group to  that user and then assign ACL to that group in Settings -> Technical -> Access Control List

2. Hiding Button Inside of the form

You can hide it by assigning groups. You can change code in Settings -> Technical -> Views.

But it will be erased if the code is upgraded, if you want to change Permanently then you can change it in cod.

Thanks


Ảnh đại diện
Huỷ bỏ