diff --git a/addons/mail/models/mail_activity.py b/addons/mail/models/mail_activity.py index 682e7dcddc6..6b8fdfb280b 100644 --- a/addons/mail/models/mail_activity.py +++ b/addons/mail/models/mail_activity.py @@ -326,8 +326,8 @@ class MailActivity(models.Model): model.check_access_rights('read') except exceptions.AccessError: raise exceptions.UserError( - _('Assigned user %s has no access to the document and is not able to handle this activity.') % - activity.user_id.display_name) + _('Assigned user %s has no access to the document and is not able to handle this activity.', + activity.user_id.display_name)) else: try: target_user = activity.user_id @@ -339,8 +339,8 @@ class MailActivity(models.Model): model.browse(activity.res_id).check_access_rule('read') except exceptions.AccessError: raise exceptions.UserError( - _('Assigned user %s has no access to the document and is not able to handle this activity.') % - activity.user_id.display_name) + _('Assigned user %s has no access to the document and is not able to handle this activity.', + activity.user_id.display_name)) # ------------------------------------------------------ # ORM overrides diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index bee474a3ce7..0f2e80f47eb 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -298,7 +298,7 @@ class Channel(models.Model): channel_info['is_pinned'] = False self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', partner.id), channel_info) if not self.email_send: - notification = _('
left #%s
') % (self.id, self.name,) + notification = _('
left #%s
', self.id, self.name) # post 'channel left' message as root since the partner just unsubscribed from the channel self.sudo().message_post(body=notification, subtype_xmlid="mail.mt_comment", author_id=partner.id) return result @@ -339,14 +339,14 @@ class Channel(models.Model): channel.write({'channel_last_seen_partner_ids': [Command.create({'partner_id': partner_id}) for partner_id in partners_to_add.ids]}) for partner in partners_to_add: if partner.id != self.env.user.partner_id.id: - notification = _('
%(author)s invited %(new_partner)s to #%(channel_name)s
') % { - 'author': self.env.user.display_name, - 'new_partner': partner.display_name, - 'channel_id': channel.id, - 'channel_name': channel.name, - } + notification = _('
%(author)s invited %(new_partner)s to #%(channel_name)s
', + author=self.env.user.display_name, + new_partner=partner.display_name, + channel_id=channel.id, + channel_name=channel.name, + ) else: - notification = _('
joined #%s
') % (channel.id, channel.name,) + notification = _('
joined #%s
', channel.id, channel.name) self.message_post(body=notification, message_type="notification", subtype_xmlid="mail.mt_comment", author_id=partner.id, notify_by_email=False) # broadcast the channel header to the added partner @@ -362,8 +362,8 @@ class Channel(models.Model): if failed: raise UserError( - _('Following invites are invalid as user groups do not match: %s') % - ', '.join('%s (channel %s)' % (partner.name, channel.name) for channel, partner in failed) + _('Following invites are invalid as user groups do not match: %s', + ', '.join('%s (channel %s)' % (partner.name, channel.name) for channel, partner in failed)) ) def _can_invite(self, partner_id): @@ -978,7 +978,7 @@ class Channel(models.Model): self.ensure_one() added = self.action_follow() if added and self.channel_type == 'channel' and not self.email_send: - notification = _('
joined #%s
') % (self.id, self.name,) + notification = _('
joined #%s
', self.id, self.name) self.message_post(body=notification, message_type="notification", subtype_xmlid="mail.mt_comment") if added and self.moderation_guidelines: @@ -1002,7 +1002,7 @@ class Channel(models.Model): 'public': privacy, 'email_send': False, }) - notification = _('
created #%s
') % (new_channel.id, new_channel.name,) + notification = _('
created #%s
', new_channel.id, new_channel.name) new_channel.message_post(body=notification, message_type="notification", subtype_xmlid="mail.mt_comment") channel_info = new_channel.channel_info('creation')[0] self.env['bus.bus'].sendone((self._cr.dbname, 'res.partner', self.env.user.partner_id.id), channel_info) @@ -1105,7 +1105,7 @@ class Channel(models.Model): else: all_channel_partners = self.env['mail.channel.partner'].with_context(active_test=False) channel_partners = all_channel_partners.search([('partner_id', '!=', partner.id), ('channel_id', '=', self.id)]) - msg = _("You are in a private conversation with @%s.") % (channel_partners[0].partner_id.name if channel_partners else _('Anonymous')) + msg = _("You are in a private conversation with @%s.", channel_partners[0].partner_id.name if channel_partners else _('Anonymous')) msg += self._execute_command_help_message_extra() self._send_transient_message(partner, msg) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index 6dd9c5edb6f..0c70f87735c 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -367,7 +367,7 @@ class Message(models.Model): message.id = ANY (%%s)''' % (self._table), ('comment', self.ids,)) if self._cr.fetchall(): 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) + _('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:'), self.ids[:6], _('User:'), self._uid) ) @@ -580,7 +580,7 @@ class Message(models.Model): if not self.browse(messages_to_check).exists(): return 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) + _('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:'), list(messages_to_check)[:6], _('User:'), self._uid) ) diff --git a/addons/mail/models/mail_render_mixin.py b/addons/mail/models/mail_render_mixin.py index 1d90284b8aa..0539716fe38 100644 --- a/addons/mail/models/mail_render_mixin.py +++ b/addons/mail/models/mail_render_mixin.py @@ -268,7 +268,7 @@ class MailRenderMixin(models.AbstractModel): render_result = view._render(variables, engine='ir.qweb', minimal_qcontext=True) except Exception as e: _logger.info("Failed to render template : %s (%d)" % (template_src, view.id), exc_info=True) - raise UserError(_("Failed to render template : %s (%d)") % (template_src, view.id)) + raise UserError(_("Failed to render template : %s (%d)", template_src, view.id)) results[record.id] = render_result return results diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 57f47d94a27..1d5bee86c35 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -377,26 +377,24 @@ class MailThread(models.AbstractModel): email_link = "%(email)s" % {'email': alias.display_name} if nothing_here: return "

%(dyn_help)s

" % { - 'dyn_help': _("Add a new %(document)s or send an email to %(email_link)s") % { - 'document': document_name, - 'email_link': email_link - } + 'dyn_help': _("Add a new %(document)s or send an email to %(email_link)s", + document=document_name, + email_link=email_link, + ) } # do not add alias two times if it was added previously if "oe_view_nocontent_alias" not in help: return "%(static_help)s

%(dyn_help)s

" % { 'static_help': help, - 'dyn_help': _("Create new %(document)s by sending an email to %(email_link)s") % { - 'document': document_name, - 'email_link': email_link, - } + 'dyn_help': _("Create new %(document)s by sending an email to %(email_link)s", + document=document_name, + email_link=email_link, + ) } if nothing_here: return "

%(dyn_help)s

" % { - 'dyn_help': _("Create new %(document)s") % { - 'document': document_name, - } + 'dyn_help': _("Create new %(document)s", document=document_name), } return help