From ea26bded7aa4f8427bbf8f9a3760ec93dc84a586 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 25 Oct 2010 12:55:55 +0200 Subject: [PATCH] [FIX] orm._check_concurrency: mention one conflicting record in exception message bzr revid: odo@openerp.com-20101025105555-owkglzq1btuvtrrx --- bin/osv/orm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index a639a775b01..e64f59f626b 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -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