[FIX] orm: inverting the condition seems to work (don't ask why)

bzr revid: mat@openerp.com-20131206142220-nfqiyeic9fdkejxy
This commit is contained in:
Martin Trigaux 2013-12-06 15:22:20 +01:00
parent 0be3333f96
commit d2ca43402e
1 changed files with 2 additions and 2 deletions

View File

@ -570,8 +570,8 @@ class one2many(_column):
else:
cr.execute('update '+_table+' set '+self._fields_id+'=null where id=%s', (act[1],))
elif act[0] == 4:
cr.execute("select 1 from {0} where id=%s and {1}!=%s".format(_table, self._fields_id), (act[1], id))
if cr.fetchone():
cr.execute("select 1 from {0} where id=%s and {1}=%s".format(_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
obj.write(cr, user, [act[1]], {self._fields_id:id}, context=context or {})
elif act[0] == 5: