This question has been flagged
3521 Views

Hi all,

My question is simple, yet i don't know the answer!!.

I want to create 4 generic groups and assign users to it.

Group Name - Group Description

  • Own Contacts - Users assigned to this group will only be able to see their own contacts
  • Team Contacts - Users assigned to this group will be able to see their own contacts and their group(sub-department) contacts
  • Department Contacts - Users assigned to this group will be able to see their own contacts and their department contacts
  • All Contacts - Users assigned to this group will be able to see all the system contacts

I have created 3 departments in hr module each with a manager

Department - Manager

  • Sales - Leo
  • Sales Team 1 - James
  • Sales Team 2 - Edward Every one has got a related user login and will be able to login to the system.

Now i would like to do implement the following logics in openerp for my groups

Own Contacts - create_uid = context.get('uid') - Works Fine

Team Contacts - create_uid.employee_id.dpt_id = context.get('uid').employee_id.dpt_id - need something like this

Department Contacts - create_uid.employee_id.dpt_id is a sub-department of context.get('uid').employee_id.dpt_id - need something like this

All Contacts - 1=1 - should work fine.

Thanks a lot if you can help me with this issue. Thanks.

Avatar
Discard
Author

Meantime, i've tried to execite this [user.rel_employee.department_id] and got the following error "NotImplementedError("Iteration is not allowed on %s" % self)". It seems that openerp's Record rule functionalities doesn't allow iteration. In that case i can't implement the above logic with record rules. Need to find some other way-out.