Skip to content
Snippets Groups Projects
Commit 3b43ddd2 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] crm: default user when copy

- Create a user A
- Create a lead, assign to A
- Deactivate user A
- Duplicate the lead

A notification email is sent to A (user assigned to the lead).

Since the user is archived, he should not receive any email since it
might contain sensitive information.

opw-778825
parent 2904192a
No related branches found
No related tags found
No related merge requests found
......@@ -336,6 +336,9 @@ class Lead(FormatAddress, models.Model):
# Set date_open to today if it is an opp
default = default or {}
default['date_open'] = fields.Datetime.now() if self.type == 'opportunity' else False
# Do not assign to an archived user
if not self.user_id.active:
default['user_id'] = False
return super(Lead, self.with_context(context)).copy(default=default)
@api.model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment