[FIX] orm._check_concurrency: mention one conflicting record in exception message

bzr revid: odo@openerp.com-20101025105555-owkglzq1btuvtrrx
This commit is contained in:
Olivier Dony 2010-10-25 12:55:55 +02:00
parent 0d2c8796b4
commit ea26bded7a
1 changed files with 5 additions and 3 deletions

View File

@ -3201,9 +3201,11 @@ class orm(orm_template):
ids_to_check.extend([id, update_date])
if not ids_to_check:
continue
cr.execute("SELECT 1 FROM %s WHERE %s" % (self._table, " OR ".join([check_clause]*(len(ids_to_check)/2))), tuple(ids_to_check))
if cr.fetchone():
raise except_orm('ConcurrencyException', _('Records were modified in the meanwhile'))
cr.execute("SELECT id FROM %s WHERE %s" % (self._table, " OR ".join([check_clause]*(len(ids_to_check)/2))), tuple(ids_to_check))
res = cr.fetchone()
if res:
# mention the first one only to keep the error message readable
raise except_orm('ConcurrencyException', _('A document was modified since you last viewed it (%s:%d)') % (self._description, res[0]))
def check_access_rule(self, cr, uid, ids, operation, context=None):
"""Verifies that the operation given by ``operation`` is allowed for the user