diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml
index 29e2a3dcefb..efbf61de851 100644
--- a/addons/crm/views/crm_lead_views.xml
+++ b/addons/crm/views/crm_lead_views.xml
@@ -670,8 +670,10 @@
code
- if env.context.get('active_model') == 'crm.lead' and env.context.get('active_ids'):
- env['crm.lead'].browse(context['active_ids']).action_set_lost()
+ if context.get('active_model') == 'crm.lead' and context.get('active_ids'):
+ action_values = env.ref('crm.crm_lead_lost_action').read()[0]
+ action_values.update({'context': context})
+ action = action_values
diff --git a/addons/crm/wizard/crm_lead_lost.py b/addons/crm/wizard/crm_lead_lost.py
index df80cac0303..4bcdf46992a 100644
--- a/addons/crm/wizard/crm_lead_lost.py
+++ b/addons/crm/wizard/crm_lead_lost.py
@@ -7,10 +7,10 @@ class CrmLeadLost(models.TransientModel):
_name = 'crm.lead.lost'
_description = 'Get Lost Reason'
- lead_id = fields.Many2one('crm.lead', 'Lead', required=True)
lost_reason_id = fields.Many2one('crm.lost.reason', 'Lost Reason')
@api.multi
def action_lost_reason_apply(self):
- self.lead_id.lost_reason = self.lost_reason_id
- return self.lead_id.action_set_lost()
+ leads = self.env['crm.lead'].browse(self.env.context.get('active_ids'))
+ leads.write({'lost_reason': self.lost_reason_id.id})
+ return leads.action_set_lost()
diff --git a/addons/crm/wizard/crm_lead_lost_views.xml b/addons/crm/wizard/crm_lead_lost_views.xml
index 512baa711a0..844e5e91d5f 100644
--- a/addons/crm/wizard/crm_lead_lost_views.xml
+++ b/addons/crm/wizard/crm_lead_lost_views.xml
@@ -6,7 +6,6 @@