[IMP] crm: restore default stage probably when restoring leads
Purpose of this commit is to avoid having restored leads and opportunities having always 0 probability even if the stage has an high probably than that. This commit is linked to task ID 1880051 and PR #26977.
This commit is contained in:
@@ -451,6 +451,14 @@ class Lead(models.Model):
|
||||
'context': {'default_type': 'opportunity'}
|
||||
}
|
||||
|
||||
def toggle_active(self):
|
||||
""" When re-activating leads and opportunities set their probability
|
||||
to the default stage one. """
|
||||
res = super(Lead, self).toggle_active()
|
||||
for lead in self.filtered(lambda lead: lead.active and lead.stage_id.probability):
|
||||
lead.probability = lead.stage_id.probability
|
||||
return res
|
||||
|
||||
# ----------------------------------------
|
||||
# Business Methods
|
||||
# ----------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user