This question has been flagged
2 Replies
2633 Views

How can I filtter saleperson selection list based on sales channel in CRM. Now salesperson list all employees by default.

For example wanted behavior "America" sales channel have only 3 members, the sales person list shows only that 3 membes, and not all emplyees.

I tried to add domain filtter to salesperson field: <field name="user_id" domain="[('share', '=', False), ('user_id', '=', team_id.member.ids.id)]">

Avatar
Discard
Best Answer

Hello Simo,

The domain that you are using is wrong. member_ids is not a Many2many field. It is a One2many field.

Use the following domain,

domain="[('share', '=', False), ('sale_team_id', '=', team_id)]"

Hope this helps,

Thank You

Avatar
Discard
Best Answer

You have two fields sales channel and sales person and on the change of sales channel you needs sales person that are related to sales person. In odoo / openerp you can do this using domain. In other word you need dependent dropdown / many2one.

1 @api.onchange('campus_id')
2 def _campus_onchange(self):
3     res = {}
4     res['domain']={'department_id':[('campus_id', '=', self.campus_id.id)]}
5 return res

For further info and details visit: http://learnopenerp.blogspot.com/2016/10/onchange-many2one-filed-in-odoo.html


Avatar
Discard