summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authordut-odoo <dut@odoo.com>2016-06-27 15:30:27 +0530
committerfwi-odoo <fwi@odoo.com>2016-11-08 11:15:27 +0100
commit42226de46ea0cb2ff93f8e34af323fb1d805fce0 (patch)
tree469d27261822533961ef04c3bdcc32f29c70a8ce /addons
parentefdb5373c31a82af3be3157b05c4e33fe647642f (diff)
[IMP] crm: show lost opportunities to merge with existing opportunities
Diffstat (limited to 'addons')
-rw-r--r--addons/crm/models/crm_lead.py2
-rw-r--r--addons/crm/wizard/crm_lead_to_opportunity.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py
index 35de09125da..1919c24a9df 100644
--- a/addons/crm/models/crm_lead.py
+++ b/addons/crm/models/crm_lead.py
@@ -658,6 +658,8 @@ class Lead(FormatAddress, models.Model):
domain = partner_match_domain
if not include_lost:
domain += ['&', ('active', '=', True), ('probability', '<', 100)]
+ else:
+ domain += ['|', '&', ('type', '=', 'lead'), ('active', '=', True), ('type', '=', 'opportunity')]
return self.search(domain)
@api.multi
diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py
index 4bca3debb07..2a12813a8f4 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity.py
+++ b/addons/crm/wizard/crm_lead_to_opportunity.py
@@ -122,7 +122,9 @@ class Lead2OpportunityPartner(models.TransientModel):
values['partner_id'] = self.partner_id.id
if self.name == 'merge':
- leads = self.opportunity_ids.merge_opportunity()
+ leads = self.with_context(active_test=False).opportunity_ids.merge_opportunity()
+ if not leads.active:
+ leads.write({'active': True, 'next_activity_id': False, 'lost_reason': False})
if leads.type == "lead":
values.update({'lead_ids': leads.ids, 'user_ids': [self.user_id.id]})
self.with_context(active_ids=leads.ids)._convert_opportunity(values)