flectra/addons/crm/wizard/crm_lead_lost.py

17 lines
479 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from odoo 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()