[MOD] crm_lead : set an error message when stage is not defined

bzr revid: vir@tinyerp.com-20100728060048-wptqdxwrbq8dqk77
This commit is contained in:
DBR(Open ERP) 2010-07-28 11:30:48 +05:30 committed by Vir (Open ERP)
parent 635fbbd2c0
commit 60afe7e093
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -131,6 +131,7 @@
<field eval="&quot;Smith John&quot;" name="partner_name2"/>
<field eval="&quot;(487) 013-1504&quot;" name="partner_mobile"/>
<field name="categ_id" ref="crm.categ_oppor6"/>
<field name="stage_id" ref="crm.stage_lead1"/>
<field eval="&quot;Website Visitor&quot;" name="partner_name"/>
<field eval="&quot;smith_john@gmail.com&quot;" name="email_from"/>
<field eval="time.strftime('%Y-%m-16 10:05:15')" name="date"/>