summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@openerp.com>2013-10-16 16:48:49 +0200
committerDenis Ledoux <dle@openerp.com>2013-10-16 16:48:49 +0200
commitb95f5443db1c3ff019dcd3d4e9652ef64675e9e9 (patch)
tree142fffeaa1c7914236434bdeae4f2d81f9e69a0b
parentfa9905e335162ab48057d041a90561c6a44f7d44 (diff)
[FIX]crm: leads/opps merge order, was not the same as before the state removal from the stages
bzr revid: dle@openerp.com-20131016144849-yueclv7xqmk806nz
-rw-r--r--addons/crm/crm_lead.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 9c7908a3b93..a4350e5ce5b 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -611,10 +611,12 @@ class crm_lead(format_address, osv.osv):
opportunities = self.browse(cr, uid, ids, context=context)
sequenced_opps = []
+ # Sorting the leads/opps according to the confidence level of its stage, which relates to the probability of winning it
+ # The confidence level increases with the stage sequence, except when the stage probability is 0.0 (Lost cases)
+ # An Opportunity always has higher confidence level than a lead, unless its stage probability is 0.0
for opportunity in opportunities:
sequence = -1
- # TDE: was "if opportunity.stage_id and opportunity.stage_id.state != 'cancel':"
- if opportunity.probability == 0 and opportunity.stage_id and opportunity.stage_id.sequence != 1 and opportunity.stage_id.fold:
+ if opportunity.stage_id and opportunity.stage_id.probability != 0 and opportunity.stage_id.sequence != 1:
sequence = opportunity.stage_id.sequence
sequenced_opps.append(((int(sequence != -1 and opportunity.type == 'opportunity'), sequence, -opportunity.id), opportunity))