This question has been flagged
4 Replies
2649 Views

User is also a kind of res_partners, so all sales person can see all the users in the system and even modify them under menu Sales/Customers.

This is not make sense.. .How to prevent from this??

Avatar
Discard
Author Best Answer

For such case my solution is as below:

 Extended the existing window action, and add a domain to restrict the records.

<record id="base.action_partner_form" model="ir.actions.act_window">

    <field name="domain">[('user_ids', '=', False)]</field>

</record>

Avatar
Discard
Best Answer

For res.partner object you create/modify ir.rule with read access for selected sales group and with Rule Definition (Domain Filter) like this:

['|',('customer', '=', 1),('supplier', '=', 1)]

Internal user as kind res.partner is not a Customer and not a Supplier.

Avatar
Discard
Author

This solution is able to restrict records in res.partner view, but this could result in another problem....After enable this ir.rule, the user cannot see the other user's infomation in the other view, such as Sales/Sales Teams.

In this case you create new group/s and similar new ir.rule based on value of field section_id - corresponding to Sales Team.