[FIX] Avoid to update a field if this one is not stored
authorStephane Wirtel <stephane@openerp.com>
Mon, 20 Dec 2010 12:03:32 +0000 (13:03 +0100)
committerStephane Wirtel <stephane@openerp.com>
Mon, 20 Dec 2010 12:03:32 +0000 (13:03 +0100)
bzr revid: stephane@openerp.com-20101220120332-k23l2jnzjqzn9s5m

bin/osv/orm.py

index 8398213..22fc609 100644 (file)
@@ -2235,12 +2235,12 @@ class orm(orm_template):
                 if v is None:
                     r[key] = False
                 if key in self._columns.keys():
-                    type = self._columns[key]._type
+                    field = self._columns[key]
                 elif key in self._inherit_fields.keys():
-                    type = self._inherit_fields[key][2]._type
+                    field = self._inherit_fields[key][2]
                 else:
                     continue
-                if type == 'reference' and v:
+                if field._type == 'reference' and getattr(field, 'store', True) and v:
                     model,ref_id = v.split(',')
                     table = self.pool.get(model)._table
                     cr.execute('select id from "%s" where id=%%s' % (table,), (ref_id,))