Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0][FIX] models: avoid UnicodeEncodeError from translation #1225

Open
wants to merge 1 commit into
base: 10.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions odoo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,7 @@ def valid(fname):
'The requested operation cannot be completed due to security restrictions. '
'Please contact your system administrator.\n\n(Document type: %s, Operation: %s)'
) % (self._description, operation)
+ ' - ({} {}, {} {})'.format(_('User:'), self._uid, _('Fields:'), ', '.join(invalid_fields))
+ u' - ({} {}, {} {})'.format(_('User:'), self._uid, _('Fields:'), ', '.join(invalid_fields))
)

return fields
Expand Down Expand Up @@ -3202,7 +3202,7 @@ def qualify(field):
# store an access error exception in existing records
exc = AccessError(
_('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: %s, Operation: %s)') % (self._description, 'read')
+ ' - ({} {}, {} {})'.format(_('Records:'), self.ids[:6], _('User:'), self._uid)
+ u' - ({} {}, {} {})'.format(_('Records:'), self.ids[:6], _('User:'), self._uid)
)
forbidden._cache.update(FailedValue(exc))

Expand Down Expand Up @@ -3288,7 +3288,7 @@ def _check_record_rules_result_count(self, result_ids, operation):
_logger.info('Access Denied by record rules for operation: %s on record ids: %r, uid: %s, model: %s', operation, forbidden_ids, self._uid, self._name)
raise AccessError(
_('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: %s, Operation: %s)') % (self._description, operation)
+ ' - ({} {}, {}, {})'.format(_('Records:'), forbidden_ids[:6], _('User:'), self._uid)
+ u' - ({} {}, {}, {})'.format(_('Records:'), forbidden_ids[:6], _('User:'), self._uid)
)
else:
# If we get here, the missing_ids are not in the database
Expand All @@ -3300,7 +3300,7 @@ def _check_record_rules_result_count(self, result_ids, operation):
_logger.info('Failed operation on deleted record(s): %s, uid: %s, model: %s', operation, self._uid, self._name)
raise MissingError(
_('Missing document(s)') + ':' + _('One of the documents you are trying to access has been deleted, please try again after refreshing.')
+ '\n\n({} {}, {} {}, {} {}, {} {})'.format(
+ u'\n\n({} {}, {} {}, {} {}, {} {})'.format(
_('Document type:'), self._description, _('Operation:'), operation,
_('Records:'), missing_ids[:6], _('User:'), self._uid,
)
Expand Down Expand Up @@ -3694,7 +3694,7 @@ def _write(self, vals):
if cr.rowcount != len(sub_ids):
raise MissingError(
_('One of the records you are trying to modify has already been deleted (Document type: %s).') % self._description
+ '\n\n({} {}, {} {})'.format(_('Records:'), sub_ids[:6], _('User:'), self._uid)
+ u'\n\n({} {}, {} {})'.format(_('Records:'), sub_ids[:6], _('User:'), self._uid)
)

# TODO: optimize
Expand Down