[FIX] models: fix write() on inherited field that is not a column of parent

This commit is contained in:
Raphael Collet 2015-09-11 17:03:08 +02:00
parent 35233dbbe2
commit 1a47ac3921
1 changed files with 7 additions and 6 deletions

View File

@ -3924,8 +3924,8 @@ class BaseModel(object):
# for recomputing new-style fields # for recomputing new-style fields
recs.modified(upd_todo) recs.modified(upd_todo)
unknown_fields = updend[:] unknown_fields = set(updend)
for table in self._inherits: for table, inherit_field in self._inherits.iteritems():
col = self._inherits[table] col = self._inherits[table]
nids = [] nids = []
for sub_ids in cr.split_for_in_conditions(ids): for sub_ids in cr.split_for_in_conditions(ids):
@ -3934,10 +3934,11 @@ class BaseModel(object):
nids.extend([x[0] for x in cr.fetchall()]) nids.extend([x[0] for x in cr.fetchall()])
v = {} v = {}
for val in updend: for fname in updend:
if self._inherit_fields[val][0] == table: field = self._fields[fname]
v[val] = vals[val] if field.inherited and field.related[0] == inherit_field:
unknown_fields.remove(val) v[fname] = vals[fname]
unknown_fields.discard(fname)
if v: if v:
self.pool[table].write(cr, user, nids, v, context) self.pool[table].write(cr, user, nids, v, context)