From 60afe7e0930ee006dd1861b1dca0bccb233e96c1 Mon Sep 17 00:00:00 2001 From: "DBR(Open ERP)" <> Date: Wed, 28 Jul 2010 11:30:48 +0530 Subject: [PATCH] [MOD] crm_lead : set an error message when stage is not defined bzr revid: vir@tinyerp.com-20100728060048-wptqdxwrbq8dqk77 --- addons/crm/crm_lead.py | 7 +++++++ addons/crm/crm_lead_demo.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 9cb5f31d67e..e69a58206ae 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -164,6 +164,13 @@ class crm_lead(osv.osv, crm_case): 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c), 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], } + + def create(self, cr, uid, vals, context=None): + lead_id = vals and vals.get('stage_id',False) + if not lead_id: + raise osv.except_osv('Error', _('There is no stage defined for this Sales Team')) + res_id = super(crm_lead, self).create(cr, uid, vals, context=context) + return res_id def onchange_partner_address_id(self, cr, uid, ids, add, email=False): """This function returns value of partner email based on Partner Address diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index 7101473589b..9b7b1da2031 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -131,6 +131,7 @@ +