[IMP] crm: show lost opportunities to merge with existing opportunities
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user