Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
9341 มุมมอง

Hy,

I found great ressources on how to hide the edit button : http://help.openerp.com/question/14340/how-to-remove-save-button-from-form-view/ It works perfectly.

Yet I would like to generate the false value for specific groups. Here is my different tests.

Failed : edit="[('project.group_project_manager','in',[g.id for g in user.groups_id]))]"
Failed : edit="[(12,'in',[g.id for g in user.groups_id])]"
Failed : edit="[(%(project.group_project_manager)d,'in',[g.id for g in user.groups_id]))]"

First, is it possible and then is there any mistake in my code?

regards

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Obviously, it's not possible to get the current groups in view. So the solution is to create a boolean in python file and then to use it in the view

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You have to uncheck the role Write for those groups in Configuration -> Technical -> Security

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Not in Python code, but in the xml view, by using the attributes attrs and states and invisible for form elements.

Read this for a quick resume

Look for a How to here and here

อวตาร
ละทิ้ง

That was my first thought too, but I don't think it will work. You may can hide the whole form, but not just the edit or create button.

Feel free to put me right.

คำตอบที่ดีที่สุด

The OpenERP way of restricting the edit rights for some groups is using Access Rights.
(Settings -> Technical -> Security -> Access Control Lists)
Or as csv file: /module/security/ir.model.access.csv

Still I agree, that it would be nice if Access Rights would completely hide the buttons, which does not happen (Access Error messages are displayed when a user tries a forbidden action).

Regards.

อวตาร
ละทิ้ง