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

Is there a way to skip access rights for specific user?

Scenario:

I am in a Multi Company environment and I have two companies Company AB that is a Main Company, Company A and Company B which are the child of Company AB.

Now user of Company A wants to access the records of Company B (In web client and by code). So how to access them or how to skip the access rights for specific user?

Is there a any way/trick to overcome from this by creating some record rules?

Suggestions are most welcome.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi..

Ya you can deceive the access rights for a user... using method "check_access_rights" which returns True if the user has access over an object... if it returns False, then you achieve the same by passing SUPERUSER_ID...

Example: In my case am trying to check whether user has delete permission for Crm.Lead... If he dont have am still proceeding with the action by passing SUPERUSER_ID...

              if not self.check_access_rights(cr, uid, 'unlink', raise_exception=False):
                                lead_obj.unlink(cr, SUPERUSER_ID, lead_ids, context=context)
              else:
                                lead_obj.unlink(cr, uid, lead_ids, context=context)

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