[IMP] crm: added sql constraint to restrict field 'probability'

bzr revid: cha@tinyerp.com-20121119100843-kxy55wnvb6djt0sw
This commit is contained in:
Ajay Chauhan (OpenERP) 2012-11-19 15:38:43 +05:30
parent 66afff1b52
commit 087fe434b8
1 changed files with 4 additions and 0 deletions

View File

@ -276,6 +276,10 @@ class crm_lead(base_stage, format_address, osv.osv):
'color': 0,
}
_sql_constraints = [
('check_probability', 'check(probability <= 100)', 'Probability can not be more than 100% !')
]
def create(self, cr, uid, vals, context=None):
obj_id = super(crm_lead, self).create(cr, uid, vals, context)
section_id = self.browse(cr, uid, obj_id, context=context).section_id