Skip to Content
Menu
This question has been flagged
3 Replies
5169 Views

How do I make the user sees only his own customers

And how to make the manager  sees  only his employees customers 

And how to make admin see all customers

Avatar
Discard

you can use access rule. For admin, it bypass anyway all access rights and access rule.

Author Best Answer

what is the rule for the manager of user or employee to show only his users customers

Avatar
Discard
Best Answer

inherit the  'action_customer_partner_form' action and update the domain as follows

<field name="domain">[('customer','=',1),'|',('user_id.id','=',uid),('employee_id.department_id.manager_id.user_id.id','=',uid)]</field>

where the employee_id field is the related employee ID of the user who created the customer.

Using this, each user will see only the records he created only in the customer table, the department managers will see the records they created and all records created by their subordinates only.

As per Jérémy comment, the admin can see all records.

You have to add the employee_id feild to the 'res.partern' table and update it while adding new customers

Avatar
Discard
Author

I have tested this But I got an error: Traceback (most recent call last): File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 537, in _handle_exception File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 574, in dispatch File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 310, in _call_function File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\service\model.py", line 118, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 307, in checked_call File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 803, in __call__ File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 403, in response_wrap File "C:\Program Files\Odoo 8.0-20151123\server\openerp\addons\web\controllers\main.py", line 884, in search_read File "C:\Program Files\Odoo 8.0-20151123\server\openerp\addons\web\controllers\main.py", line 905, in do_search_read File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\http.py", line 908, in proxy File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\api.py", line 250, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\models.py", line 5167, in search_read File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\api.py", line 250, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\models.py", line 1645, in search File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\api.py", line 250, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\openerp\addons\base\res\res_partner.py", line 656, in _search File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\api.py", line 250, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\models.py", line 4672, in _search File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\api.py", line 250, in wrapper File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\models.py", line 4483, in _where_calc File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\osv\expression.py", line 662, in __init__ File "C:\Program Files\Odoo 8.0-20151123\server\.\openerp\osv\expression.py", line 830, in parse ValueError: Invalid field u'employee_id.department_id.manager_id.user_id.id' in leaf ""

Related Posts Replies Views Activity
0
Nov 16
2424
1
Nov 22
1358
1
Mar 15
6593
0
Nov 24
70
2
May 24
533