[FIX] parent_model is null if local column

bzr revid: mat@openerp.com-20140324164334-pvzevi2bnmb642ak
This commit is contained in:
Martin Trigaux 2014-03-24 17:43:34 +01:00
parent 66d6fb065f
commit 33c6f108c0
1 changed files with 2 additions and 2 deletions

View File

@ -571,8 +571,8 @@ class one2many(_column):
else:
cr.execute('update '+_table+' set '+self._fields_id+'=null where id=%s', (act[1],))
elif act[0] == 4:
field_model = obj.pool.get(self._obj)._all_columns[self._fields_id].parent_model
field_table = obj.pool.get(field_model)._table
field_model = self._fields_id in obj.pool[self._obj]._columns and self._obj or obj.pool[self._obj]._all_columns[self._fields_id].parent_model
field_table = obj.pool[field_model]._table
cr.execute("select 1 from {0} where id=%s and {1}=%s".format(field_table, self._fields_id), (act[1], id))
if not cr.fetchone():
# Must use write() to recompute parent_store structure if needed and check access rules