This commit is contained in:
Cédric Krier
2008-01-19 00:17:46 +01:00
2 changed files with 12 additions and 6 deletions
+11 -5
View File
@@ -234,15 +234,21 @@ class ModelData(OSV):
"data with the wrong model.")
object_ref = self.pool.get(model)
# XXX maybe use a browse instead:
db_values = object_ref.read(cursor, user, db_id, values.keys())
db_values = object_ref.browse(cursor, user, db_id)
to_update = {}
for key in values:
# first handle correctly the datas returned by read()
if object_ref._columns[key]._type == 'many2one':
db_field = db_values[key] and db_values[key][0] or False
elif object_ref._columns[key]._type in ['one2one', 'one2many', "many2many"]:
# search the field type in the object or in a parent
if key in object_ref._columns:
field_type = object_ref._columns[key]._type
else:
field_type = object_ref._inherit_fields[key][2]._type
# handle the value regarding to the type
if field_type == 'many2one':
db_field = db_values[key] and db_values[key].id or False
elif field_type in ['one2one', 'one2many', "many2many"]:
logger = Logger()
logger.notify_channel('init', LOG_WARNING,
'Field %s on %s : integrity not tested.'%(key, model))
+1 -1
View File
@@ -69,7 +69,7 @@ class User(OSV):
'action_id': fields.Many2One('ir.action', 'Home Action'),
'menu_id': fields.Many2One('ir.action', 'Menu Action'),
'groups_id': fields.Many2Many('res.group', 'res_group_user_rel',
'uid', 'gid', 'Groups'),
'uid', 'gid', 'Groups'),
'roles_id': fields.Many2Many('res.role', 'res_role_user_rel',
'uid', 'rid', 'Roles'),
#'company_id': fields.Many2One('res.company', 'Company'),