[FIX] Copy() of ir_model_fields corected

bzr revid: ach@tinyerp.com-20100511105508-n4png61qm0w8ctot
This commit is contained in:
Anup (OpenERP) 2010-05-11 16:25:08 +05:30
parent ee6e52fac7
commit 2d69e871a3
2 changed files with 5 additions and 3 deletions

View File

@ -260,6 +260,8 @@ class ir_model_fields(osv.osv):
if 'model_id' in vals:
model_data = self.pool.get('ir.model').browse(cr, user, vals['model_id'])
vals['model'] = model_data.model
if context is None:
context = {}
if context and context.get('manual',False):
vals['state'] = 'manual'
res = super(ir_model_fields,self).create(cr, user, vals, context)
@ -267,7 +269,7 @@ class ir_model_fields(osv.osv):
if not vals['name'].startswith('x_'):
raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !"))
if 'relation' in vals and not self.pool.get('ir.model').search(cr, user, [('model','=',vals['relation'])]):
if vals.get('relation',False) and not self.pool.get('ir.model').search(cr, user, [('model','=',vals['relation'])]):
raise except_orm(_('Error'), _("Model %s Does not Exist !" % vals['relation']))
if self.pool.get(vals['model']):

View File

@ -276,7 +276,7 @@ class browse_record(object):
else:
new_data[n] = data[n]
self._data[data['id']].update(new_data)
if not name in self._data[self._id]:
#how did this happen?
self.logger.notifyChannel("browse_record", netsvc.LOG_ERROR,
@ -438,7 +438,7 @@ class orm_template(object):
'name': k,
'field_description': f.string.replace("'", " "),
'ttype': f._type,
'relation': f._obj or 'NULL',
'relation': f._obj or '',
'view_load': (f.view_load and 1) or 0,
'select_level': tools.ustr(f.select or 0),
'readonly':(f.readonly and 1) or 0,