[MERGE] [FIX] orm: Ignore orm (4, *) operations on one2many if link already exists.
Web client returns (4, ) operations for unchanged line in one2many widgets. This allows to skip orm write on object where potentially has no access (eg: timesheet line with another user). (opw 599494) bzr revid: mat@openerp.com-20131206144301-k6ugjota873nz75d
This commit is contained in:
@@ -570,8 +570,10 @@ class one2many(_column):
|
||||
else:
|
||||
cr.execute('update '+_table+' set '+self._fields_id+'=null where id=%s', (act[1],))
|
||||
elif act[0] == 4:
|
||||
# Must use write() to recompute parent_store structure if needed
|
||||
obj.write(cr, user, [act[1]], {self._fields_id:id}, context=context or {})
|
||||
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:
|
||||
reverse_rel = obj._all_columns.get(self._fields_id)
|
||||
assert reverse_rel, 'Trying to unlink the content of a o2m but the pointed model does not have a m2o'
|
||||
|
||||
Reference in New Issue
Block a user