Use a global key for _timestamp in context to work with one2many

This commit is contained in:
Cédric Krier committed 2009-01-22 20:34:39 +01:00
1 parent 7af7f0dd21
commit 0bc2372c2c
2 files changed
+12 -7

No files matched your search

-1
View File
@@ -10,4 +10,3 @@
- Change _constraint to pass a BrowseRecordList instead of a list of ids
- Change action, menu on res.user into a Many2Many
- Add order attribute on page tag
- Allow to pass a context in xxx2xxx operation (it will allow to pass _timestamp)
+12 -6
View File
@@ -1492,9 +1492,10 @@ class ORM(object):
' > %s)'
args = []
for i in sub_ids:
if context['_timestamp'].get(i):
if context['_timestamp'].get(self._name + ',' + str(i)):
args.append(i)
args.append(context['_timestamp'][i])
args.append(context['_timestamp'][
self._name + ',' +str(i)])
if args:
cursor.execute("SELECT id " \
'FROM "' + self._table + '" ' \
@@ -1503,7 +1504,9 @@ class ORM(object):
if cursor.rowcount:
raise Exception('ConcurrencyException',
'Records were modified in the meanwhile')
del context['_timestamp']
for i in ids:
if context['_timestamp'].get(self._name + ',' + str(i)):
del context['_timestamp'][self._name + ',' +str(i)]
self.pool.get('ir.model.access').check(cursor, user, self._name,
'delete', context=context)
@@ -1633,9 +1636,10 @@ class ORM(object):
' > %s)'
args = []
for i in sub_ids:
if context['_timestamp'].get(i):
if context['_timestamp'].get(self._name + ',' + str(i)):
args.append(i)
args.append(context['_timestamp'][i])
args.append(context['_timestamp'][
self._name + ',' +str(i)])
if args:
cursor.execute("SELECT id " \
'FROM "' + self._table + '" ' \
@@ -1644,7 +1648,9 @@ class ORM(object):
if cursor.rowcount:
raise Exception('ConcurrencyException',
'Records were modified in the meanwhile')
del context['_timestamp']
for i in ids:
if context['_timestamp'].get(self._name + ',' + str(i)):
del context['_timestamp'][self._name + ',' +str(i)]
self.pool.get('ir.model.access').check(cursor, user, self._name,
'write', context=context)