3
votes

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

1 Answers

1
votes

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.