[IMP] model: log a message when an AccessError happens

With the user who is trying to access and the record they are trying to access
to.
This way it is easier to understand the reason of the error.
Do not show record and user ids in the popup as it is a technical information.

Closes #13030
This commit is contained in:
Lorenzo Battistini
2017-02-03 15:42:47 +01:00
committed by Martin Trigaux
parent 3d3920dfbc
commit 269dbc9872
+3
View File
@@ -3097,6 +3097,9 @@ class BaseModel(object):
_('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: %s, Operation: %s)') % \
(self._name, 'read')
)
_logger.info(
_('The requested operation cannot be completed due to record rules: Document type: %s, Operation: %s, Records: %s, User: %s') % \
(self._name, 'read', ','.join([str(r.id) for r in self][:6]), self._uid))
forbidden._cache.update(FailedValue(exc))
@api.multi