[FIX] crm: fix archive / restore PLS inconsistencies
SPECIFICATIONS Fixes following issue: when a lead is marked as lost, the probability is correctly set to 0 but not the automatic one. If one clicks on the "Set to automatic", the probability is updated, which un-archives it without really restoring it, meaning we get in a very strange state outside the expected flow (no Won/Lost buttons, ...). With this commit the automated probability is set to 0 when setting as lost. Moreover restoring a lead recomputes its probabilities. LINKS Task ID 2092799 Manual backport of PR odoo/odoo#42015 done in master PR odoo/odoo#42045 closes odoo/odoo#42057 X-original-commit: 9ac5f42cd0c381bdddfd196721983057bab7028b Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
e72ae1aa0c
commit
9b534649d5
@@ -538,6 +538,11 @@ class Lead(models.Model):
|
||||
self.filtered(lambda lead: lead.active)._compute_probabilities()
|
||||
return True
|
||||
|
||||
def toggle_active(self):
|
||||
res = super(Lead, self).toggle_active()
|
||||
self.filtered(lambda lead: lead.active)._compute_probabilities()
|
||||
return res
|
||||
|
||||
def _rebuild_pls_frequency_table_threshold(self):
|
||||
""" Called by action_set_lost and action_set_won.
|
||||
Will run the cron to update the frequency table only if the number of lead is above
|
||||
|
||||
Reference in New Issue
Block a user