flectra/addons/crm/wizard/crm_lead_lost.py

17 lines
482 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
from flectra import api, fields, models
class CrmLeadLost(models.TransientModel):
_name = 'crm.lead.lost'
_description = 'Get Lost Reason'
lost_reason_id = fields.Many2one('crm.lost.reason', 'Lost Reason')
@api.multi
def action_lost_reason_apply(self):
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()