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

I'm using a OpenERP V7. I want to make a button invisible when it is not a specific user how can i do this? I'm trying to wrap the buttons in a group and assign attr invisible to it, so far it has not worked for me.

<group attrs="{'invisible' : [('req_department.manager_id.id','!=',user.id)]}">
                        <button name="department_change_accept_accepted" string="Accept" states="accepted" type="workflow" groups="base.group_hr_manager"/>
                        <button name="department_change_reject_accepted" string="Reject" states="accepted" type="workflow" groups="base.group_hr_manager"/>
                        </group>
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

What req_department is? I mean what is the type of this field? I guess req_department.manager_id.id doesn't work.

You may try this: [(manager_id,'=',user.id)] and remove states="accepted" from button.

Hope this will work.

Ảnh đại diện
Huỷ bỏ
Tác giả

Its a many2one field. I couldn't get it to work this way i used a functional field to get it to work by putting the cases in the method and returning True or False and checking for that.

Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 12 23
38346
1
thg 3 15
4717
3
thg 6 21
11240
1
thg 1 18
4815
4
thg 7 15
3854