[FIX] models: Always use MissingError when a document is missing

As done in write and already in next version (see 0fd773a), accessing a deleted
record (through read or check access rights) should always return a MissingError
instead of the generic except_orm.
This will allow code ignoring deleted record (e.g. 'recompute' method) to safely
process the other records.
Fixes #6105
This commit is contained in:
Anthony Muschang 2015-04-01 02:34:30 +02:00 committed by Martin Trigaux
parent 7d79520559
commit 2925bb5c9a
1 changed files with 2 additions and 2 deletions

View File

@ -3470,8 +3470,8 @@ class BaseModel(object):
# errors for non-transactional search/read sequences coming from clients
return
_logger.warning('Failed operation on deleted record(s): %s, uid: %s, model: %s', operation, uid, self._name)
raise except_orm(_('Missing document(s)'),
_('One of the documents you are trying to access has been deleted, please try again after refreshing.'))
raise MissingError(
_('One of the documents you are trying to access has been deleted, please try again after refreshing.'))
def check_access_rights(self, cr, uid, operation, raise_exception=True): # no context on purpose.