[FIX] Added sql_constraint on adding field having size<1

lp bug: https://launchpad.net/bugs/399685 fixed

bzr revid: hda@hda-20090715134530-4aj0hth1olefcpdn
This commit is contained in:
JVO,HDA 2009-07-15 19:15:30 +05:30 committed by husen daudi
parent 64ffe9c680
commit 9148c7fcdf
1 changed files with 6 additions and 2 deletions

View File

@ -229,6 +229,9 @@ class ir_model_fields(osv.osv):
'field_description': lambda *a: '',
}
_order = "id"
_sql_constraints = [
('size_gt_zero', 'CHECK (size>0)', 'Size of the field can never be less than 1 !'),
]
def unlink(self, cr, user, ids, context=None):
for field in self.browse(cr, user, ids, context):
if field.state <> 'manual':
@ -255,6 +258,7 @@ class ir_model_fields(osv.osv):
if self.pool.get(vals['model']):
self.pool.get(vals['model']).__init__(self.pool, cr)
self.pool.get(vals['model'])._auto_init(cr, {})
return res
ir_model_fields()