[FIX] crm, website_crm_partner_assign: recompute saleteam automatically
Add a constrains on user_id field to avoid to recompute manually the team_id. Eg: action_foward didn't call the onchange manually, so the saleteam not updated.
This commit is contained in:
@@ -249,6 +249,7 @@ class Lead(models.Model):
|
||||
team_id = self.env['crm.team']._get_default_team_id(user_id=user_id)
|
||||
return {'team_id': team_id}
|
||||
|
||||
@api.constrains('user_id')
|
||||
@api.onchange('user_id')
|
||||
def _onchange_user_id(self):
|
||||
""" When changing the user, also set a team_id or restrict team id to the ones user_id is member of. """
|
||||
|
||||
@@ -47,8 +47,6 @@ class CrmLead(models.Model):
|
||||
for salesman_id, leads_ids in salesmans_leads.items():
|
||||
leads = self.browse(leads_ids)
|
||||
leads.write({'user_id': salesman_id})
|
||||
for lead in leads:
|
||||
lead._onchange_user_id()
|
||||
|
||||
@api.multi
|
||||
def action_assign_partner(self):
|
||||
|
||||
Reference in New Issue
Block a user