[FIX] crm: Don't modify the sales team when removing the salesman

Purpose
=======

Currently, if we remove the salesman on the lead, the sales team will
be replace by either the sales team of the current user or the default
sales team.

That way, by removing the salesman, we loose information about the sales
team, and that way we loose information about the origin of the lead.

Specification
=============

Don't overwrite the sales team when removing the salesman on the
the lead.
This commit is contained in:
Yannick Tivisse
2018-06-12 11:34:03 +02:00
parent 8be5cc0980
commit dd3faf40fa
+2
View File
@@ -236,6 +236,8 @@ class Lead(models.Model):
@api.model
def _onchange_user_values(self, user_id):
""" returns new values when user_id has changed """
if not user_id:
return {}
if user_id and self._context.get('team_id'):
team = self.env['crm.team'].browse(self._context['team_id'])
if user_id in team.member_ids.ids: