[FIX] crm: do not assign a salesteam to a lead if not in multi sales team env

on_change_user was used to assign the first team  in which the user is a member to the lead
When the user does not use the multi sales team, it therefore set a default sales team, but invisible to the user.

Stages displayed in the kanban view are the lead sales team stages. In a non sales team env, only stages with no stages are displayed for new leads
If you added a new stage, in the kanban view, the stage is not assigned to a team
This commit is contained in:
Denis Ledoux 2014-12-11 13:21:18 +01:00
parent 1263278b74
commit a69076851a
1 changed files with 1 additions and 1 deletions

View File

@ -330,7 +330,7 @@ class crm_lead(format_address, osv.osv):
""" When changing the user, also set a section_id or restrict section id
to the ones user_id is member of. """
section_id = self._get_default_section_id(cr, uid, user_id=user_id, context=context) or False
if user_id and not section_id:
if user_id and self.pool['res.users'].has_group(cr, uid, 'base.group_multi_salesteams') and not section_id:
section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context)
if section_ids:
section_id = section_ids[0]