3

In my OpenERP 7 solution, there is a custom Purchase Order approval system that I have implemented through the PO Workflow.

But now I am stuck on another custom need. The scenario is a manager will be able to view only those Requested Purchase order which are made by his Subordinates, actually as approval Que. Subordinates are defined in HR Module.

I tried in following ways:

  1. creating a Record Rule under Security. But to write the domain code to filter, I only have PurchaseOrder Objects whose field is 'created_uid' and a logged in User Object. Logged in User object doesn't have any relation that can help fine the subordinates. I mean, User object doesn't contains who is a manager or subordinates of this logged in user. So, I have created a field in res.users model in relation with child_ids of hr_employee model. But it doesn't preloaded in logged in Users object.
  2. creating a custom window action. But same problem for domain code. Just could not find any way to filter the subordinates.

I just don't know what should be the code in domain for filtering the POs which are made by the subordinates of a logged in manager.

any kind of help will be appreciable

Thanks in advance :)

1 Answers1

1

It would be better that you follow a "Team Approach", you can define team in user and then add people to that team and make a record rule.

A harder approach would be to make it compulsory to add user_id to each employee and then can use record rule that you have mentioned.

Parthiv
  • 1,010
  • 1
  • 8
  • 19
  • Actually, each employee have a Manager or supervisor by default. So we used that to make the chain hierarchy. But problem is Record Rule applies on the Object, not on a view or window. So, if I apply the record rule then manager wont be able to see other POs. I need to restrict only on a view where the POs are listed which are only waiting for approval. btw thanks for your co-operation – Hussain KMR Behestee Aug 22 '13 at 11:07