diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index 68a903b2760..980e58a8ef7 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -42,7 +42,7 @@ class AccountAccount(models.Model): def _check_reconcile(self): for account in self: if account.internal_type in ('receivable', 'payable') and account.reconcile == False: - raise ValidationError(_('You cannot have a receivable/payable account that is not reconcilable. (account code: %s)') % account.code) + raise ValidationError(_('You cannot have a receivable/payable account that is not reconcilable. (account code: %s)', account.code)) @api.constrains('user_type_id') def _check_user_type_id(self): @@ -52,7 +52,7 @@ class AccountAccount(models.Model): if res.get('company_id_count', 0) >= 2: account_unaffected_earnings = self.search([('company_id', '=', res['company_id'][0]), ('user_type_id', '=', data_unaffected_earnings.id)]) - raise ValidationError(_('You cannot have more than one account with "Current Year Earnings" as type. (accounts: %s)') % [a.code for a in account_unaffected_earnings]) + raise ValidationError(_('You cannot have more than one account with "Current Year Earnings" as type. (accounts: %s)', [a.code for a in account_unaffected_earnings])) name = fields.Char(string="Account Name", required=True, index=True) currency_id = fields.Many2one('res.currency', string='Account Currency', @@ -445,7 +445,7 @@ class AccountAccount(models.Model): if partner_prop_acc: account_name = partner_prop_acc.get_by_record().display_name raise UserError( - _('You cannot remove/deactivate the account %s which is set on a customer or vendor.') % account_name + _('You cannot remove/deactivate the account %s which is set on a customer or vendor.', account_name) ) return super(AccountAccount, self).unlink() diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 71d6f336dac..4bddca46a3a 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -75,7 +75,7 @@ class AccountBankStmtCashWizard(models.Model): def name_get(self): result = [] for cashbox in self: - result.append((cashbox.id, _("%s")%(cashbox.total))) + result.append((cashbox.id, str(cashbox.total))) return result @api.model_create_multi @@ -308,7 +308,7 @@ class AccountBankStatement(models.Model): 'statement_id': stmt.id, 'journal_id': stmt.journal_id.id, 'amount': stmt.difference, - 'payment_ref': _("Cash difference observed during the counting (%s)") % name, + 'payment_ref': _("Cash difference observed during the counting (%s)", name), 'date': stmt.date, } self.env['account.bank.statement.line'].with_context(counterpart_account_id=account.id).create(st_line_vals) @@ -392,13 +392,13 @@ class AccountBankStatement(models.Model): for statement in self: # Chatter. - statement.message_post(body=_('Statement %s confirmed.') % statement.name) + statement.message_post(body=_('Statement %s confirmed.', statement.name)) # Bank statement report. if statement.journal_id.type == 'bank': content, content_type = self.env.ref('account.action_report_account_statement')._render(statement.id) self.env['ir.attachment'].create({ - 'name': statement.name and _("Bank Statement %s.pdf") % statement.name or _("Bank Statement.pdf"), + 'name': statement.name and _("Bank Statement %s.pdf", statement.name) or _("Bank Statement.pdf"), 'type': 'binary', 'datas': base64.encodebytes(content), 'res_model': statement._name, @@ -873,7 +873,7 @@ class AccountBankStatementLine(models.Model): if st_line.currency_id.is_zero(st_line.amount): raise ValidationError(_("The amount of a statement line can't be equal to zero.")) if st_line.foreign_currency_id == st_line.currency_id: - raise ValidationError(_("The foreign currency must be different than the journal one: %s") % st_line.currency_id.name) + raise ValidationError(_("The foreign currency must be different than the journal one: %s", st_line.currency_id.name)) if st_line.foreign_currency_id and st_line.foreign_currency_id.is_zero(st_line.amount_currency): raise ValidationError(_("The amount in foreign currency must be set if the amount is not equal to zero.")) if not st_line.foreign_currency_id and st_line.amount_currency: diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index db72d23f5f0..d8da1deea14 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -213,11 +213,11 @@ class AccountJournal(models.Model): for journal in self: if journal.type == 'bank' and journal.bank_account_id: if journal.bank_account_id.company_id and journal.bank_account_id.company_id != journal.company_id: - raise ValidationError(_('The bank account of a bank journal must belong to the same company (%s).') % journal.company_id.name) + raise ValidationError(_('The bank account of a bank journal must belong to the same company (%s).', journal.company_id.name)) # A bank account can belong to a customer/supplier, in which case their partner_id is the customer/supplier. # Or they are part of a bank journal and their partner_id must be the company's partner_id. if journal.bank_account_id.partner_id != journal.company_id.partner_id: - raise ValidationError(_('The holder of a journal\'s bank account must be the company (%s).') % journal.company_id.name) + raise ValidationError(_('The holder of a journal\'s bank account must be the company (%s).', journal.company_id.name)) @api.constrains('company_id') def _check_company_consistency(self): @@ -365,7 +365,7 @@ class AccountJournal(models.Model): journal_entry = self.env['account.move'].search([('journal_id', '=', self.id), ('state', '=', 'posted'), ('secure_sequence_number', '!=', 0)], limit=1) if len(journal_entry) > 0: field_string = self._fields['restrict_mode_hash_table'].get_description(self.env)['string'] - raise UserError(_("You cannot modify the field %s of a journal that already has accounting entries.") % field_string) + raise UserError(_("You cannot modify the field %s of a journal that already has accounting entries.", field_string)) result = super(AccountJournal, self).write(vals) for journal in self: diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index e197d28d037..aee49964d71 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -377,7 +377,7 @@ class AccountMove(models.Model): if p.invoice_warn != 'block' and p.parent_id and p.parent_id.invoice_warn == 'block': p = p.parent_id warning = { - 'title': _("Warning for %s") % p.name, + 'title': _("Warning for %s", p.name), 'message': p.invoice_warn_msg } if p.invoice_warn == 'block': @@ -758,7 +758,7 @@ class AccountMove(models.Model): return rounding_line_vals.update({ - 'name': _('%s (rounding)') % biggest_tax_line.name, + 'name': _('%s (rounding)', biggest_tax_line.name), 'account_id': biggest_tax_line.account_id.id, 'tax_repartition_line_id': biggest_tax_line.tax_repartition_line_id.id, 'tax_exigible': biggest_tax_line.tax_exigible, @@ -1582,9 +1582,9 @@ class AccountMove(models.Model): lock_date = move.company_id._get_user_fiscal_lock_date() if move.date <= lock_date: if self.user_has_groups('account.group_account_manager'): - message = _("You cannot add/modify entries prior to and inclusive of the lock date %s.") % format_date(self.env, lock_date) + message = _("You cannot add/modify entries prior to and inclusive of the lock date %s.", format_date(self.env, lock_date)) else: - message = _("You cannot add/modify entries prior to and inclusive of the lock date %s. Check the company settings or ask someone with the 'Adviser' role") % format_date(self.env, lock_date) + message = _("You cannot add/modify entries prior to and inclusive of the lock date %s. Check the company settings or ask someone with the 'Adviser' role", format_date(self.env, lock_date)) raise UserError(message) return True @@ -2284,7 +2284,7 @@ class AccountMove(models.Model): raise UserError(_('You need to add a line before posting.')) if move.auto_post and move.date > fields.Date.today(): date_msg = move.date.strftime(get_lang(self.env).date_format) - raise UserError(_("This move is configured to be auto-posted on %s") % date_msg) + raise UserError(_("This move is configured to be auto-posted on %s", date_msg)) if not move.partner_id: if move.is_sale_document(): @@ -3466,9 +3466,9 @@ class AccountMoveLine(models.Model): control_type_failed = journal.type_control_ids and account.user_type_id not in journal.type_control_ids control_account_failed = journal.account_control_ids and account not in journal.account_control_ids if control_journal_failed: - raise UserError(_('You cannot use this account (%s) in this journal, check the field \'Allowed Journals\' on the related account.') % account.display_name) + raise UserError(_('You cannot use this account (%s) in this journal, check the field \'Allowed Journals\' on the related account.', account.display_name)) if control_type_failed or control_account_failed: - raise UserError(_('You cannot use this account (%s) in this journal, check the section \'Control-Access\' under tab \'Advanced Settings\' on the related journal.') % account.display_name) + raise UserError(_('You cannot use this account (%s) in this journal, check the section \'Control-Access\' under tab \'Advanced Settings\' on the related journal.', account.display_name)) @api.constrains('account_id', 'tax_ids', 'tax_line_id', 'reconciled') def _check_off_balance(self): diff --git a/addons/account/models/account_partial_reconcile.py b/addons/account/models/account_partial_reconcile.py index 6e445c20c85..29c0c145944 100644 --- a/addons/account/models/account_partial_reconcile.py +++ b/addons/account/models/account_partial_reconcile.py @@ -67,7 +67,7 @@ class AccountPartialReconcile(models.Model): def _check_required_computed_currencies(self): bad_partials = self.filtered(lambda partial: not partial.debit_currency_id or not partial.credit_currency_id) if bad_partials: - raise ValidationError(_("Missing foreign currencies on partials having ids: %s") % bad_partials.ids) + raise ValidationError(_("Missing foreign currencies on partials having ids: %s", bad_partials.ids)) # ------------------------------------------------------------------------- # COMPUTE METHODS diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index e1581932463..ba2e519a914 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -205,9 +205,9 @@ class AccountPayment(models.Model): if self.is_internal_transfer: if self.payment_type == 'inbound': - liquidity_line_name = _('Transfer to %s') % self.journal_id.name + liquidity_line_name = _('Transfer to %s', self.journal_id.name) else: # payment.payment_type == 'outbound': - liquidity_line_name = _('Transfer from %s') % self.journal_id.name + liquidity_line_name = _('Transfer from %s', self.journal_id.name) else: liquidity_line_name = self.payment_reference diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index 0ce074b4622..7e5572aea39 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -184,7 +184,7 @@ class AccountTax(models.Model): @api.returns('self', lambda value: value.id) def copy(self, default=None): - default = dict(default or {}, name=_("%s (Copy)") % self.name) + default = dict(default or {}, name=_("%s (Copy)", self.name)) return super(AccountTax, self).copy(default=default) def name_get(self): diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 2b880c8b122..649962c411e 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -1040,7 +1040,7 @@ class AccountTaxRepartitionLineTemplate(models.Model): all_tax_rep_lines = self.mapped('plus_report_line_ids') + self.mapped('minus_report_line_ids') lines_without_tag = all_tax_rep_lines.filtered(lambda x: not x.tag_name) if lines_without_tag: - raise ValidationError(_("The following tax report lines are used in some tax repartition template though they don't generate any tag: %s . This probably means you forgot to set a tag_name on these lines.") % str(lines_without_tag.mapped('name'))) + raise ValidationError(_("The following tax report lines are used in some tax repartition template though they don't generate any tag: %s . This probably means you forgot to set a tag_name on these lines.", str(lines_without_tag.mapped('name')))) def get_repartition_line_create_vals(self, company): rslt = [(5, 0, 0)] diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 853b2321252..a793aa148e1 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -537,7 +537,7 @@ class ResCompany(models.Model): hash_corrupted = False for move in moves: if move.inalterable_hash != move._compute_hash(previous_hash=previous_hash): - rslt.update({'msg_cover': _('Corrupted data on journal entry with id %s.') % move.id}) + rslt.update({'msg_cover': _('Corrupted data on journal entry with id %s.', move.id)}) results_by_journal['results'].append(rslt) hash_corrupted = True break diff --git a/addons/account/models/res_bank.py b/addons/account/models/res_bank.py index 5b587866eef..226e1c889ad 100644 --- a/addons/account/models/res_bank.py +++ b/addons/account/models/res_bank.py @@ -36,7 +36,7 @@ class ResPartnerBank(models.Model): return self._get_qr_code_url(candidate_method, amount, currency, debtor_partner, free_communication, structured_communication) elif not silent_errors: - error_header = _("The following error prevented '%s' QR-code to be generated though it was detected as eligible: ") % candidate_name + error_header = _("The following error prevented '%s' QR-code to be generated though it was detected as eligible: ", candidate_name) raise UserError( error_header + error_message) return None diff --git a/addons/account/models/sequence_mixin.py b/addons/account/models/sequence_mixin.py index f6f4520661d..e75842f8115 100644 --- a/addons/account/models/sequence_mixin.py +++ b/addons/account/models/sequence_mixin.py @@ -96,7 +96,7 @@ class SequenceMixin(models.AbstractModel): """ self.ensure_one() if self._sequence_field not in self._fields or not self._fields[self._sequence_field].store: - raise ValidationError(_('%s is not a stored field') % self._sequence_field) + raise ValidationError(_('%s is not a stored field', self._sequence_field)) where_string, param = self._get_last_sequence_domain(relaxed) if self.id or self.id.origin: where_string += " AND id != %(id)s " diff --git a/addons/account/wizard/account_accrual_accounting.py b/addons/account/wizard/account_accrual_accounting.py index cc6dd3c98ba..b48b5d95a4b 100644 --- a/addons/account/wizard/account_accrual_accounting.py +++ b/addons/account/wizard/account_accrual_accounting.py @@ -202,7 +202,7 @@ class AccrualAccountingWizard(models.TransientModel): record.preview_data = json.dumps({ 'groups_vals': preview_vals, 'options': { - 'discarded_number': (_("%d moves") % preview_discarded) if preview_discarded else False, + 'discarded_number': _("%d moves", preview_discarded) if preview_discarded else False, 'columns': preview_columns, }, }) diff --git a/addons/account/wizard/account_transfer_wizard.py b/addons/account/wizard/account_transfer_wizard.py index c6d73973abf..709adc51f74 100644 --- a/addons/account/wizard/account_transfer_wizard.py +++ b/addons/account/wizard/account_transfer_wizard.py @@ -81,7 +81,7 @@ class AccountTransferWizard(models.TransientModel): # Generate counterpart lines' vals for (counterpart_partner, counterpart_currency), counterpart_vals in counterpart_balances.items(): source_accounts = self.move_line_ids.mapped('account_id') - counterpart_label = len(source_accounts) == 1 and _("Transfer from %s") % source_accounts.display_name or _("Transfer counterpart") + counterpart_label = len(source_accounts) == 1 and _("Transfer from %s", source_accounts.display_name) or _("Transfer counterpart") if not self.company_id.currency_id.is_zero(counterpart_vals['balance']) or (counterpart_currency and not counterpart_currency.is_zero(counterpart_vals['amount_currency'])): line_vals.append({ @@ -112,7 +112,7 @@ class AccountTransferWizard(models.TransientModel): return { 'journal_id': self.journal_id.id, 'date': self.date, - 'ref': self.destination_account_id.display_name and _("Transfer entry to %s") % self.destination_account_id.display_name or '', + 'ref': self.destination_account_id.display_name and _("Transfer entry to %s", self.destination_account_id.display_name) or '', 'line_ids': [(0, 0, line) for line in line_vals], } diff --git a/addons/auth_signup/models/res_partner.py b/addons/auth_signup/models/res_partner.py index 94e8471e00b..fe68ae5380d 100644 --- a/addons/auth_signup/models/res_partner.py +++ b/addons/auth_signup/models/res_partner.py @@ -143,11 +143,11 @@ class ResPartner(models.Model): partner = self.search([('signup_token', '=', token)], limit=1) if not partner: if raise_exception: - raise exceptions.UserError(_("Signup token '%s' is not valid") % token) + raise exceptions.UserError(_("Signup token '%s' is not valid", token)) return False if check_validity and not partner.signup_valid: if raise_exception: - raise exceptions.UserError(_("Signup token '%s' is no longer valid") % token) + raise exceptions.UserError(_("Signup token '%s' is no longer valid", token)) return False return partner diff --git a/addons/auth_signup/models/res_users.py b/addons/auth_signup/models/res_users.py index c600d969e9d..3aaa43f0f18 100644 --- a/addons/auth_signup/models/res_users.py +++ b/addons/auth_signup/models/res_users.py @@ -123,7 +123,7 @@ class ResUsers(models.Model): invite_partner = user.create_uid.partner_id if invite_partner: # notify invite user that new user is connected - title = _("%s connected") % user.name + title = _("%s connected", user.name) message = _("This is his first connection. Wish him welcome") self.env['bus.bus'].sendone( (self._cr.dbname, 'res.partner', invite_partner.id), @@ -196,7 +196,7 @@ class ResUsers(models.Model): for user in self: if not user.email: - raise UserError(_("Cannot send email: user %s has no email address.") % user.name) + raise UserError(_("Cannot send email: user %s has no email address.", user.name)) # TDE FIXME: make this template technical (qweb) with self.env.cr.savepoint(): force_send = not(self.env.context.get('import_file', False)) diff --git a/addons/base_address_extended/models/res_partner.py b/addons/base_address_extended/models/res_partner.py index 963da5e9b72..7ddb2acc6c6 100644 --- a/addons/base_address_extended/models/res_partner.py +++ b/addons/base_address_extended/models/res_partner.py @@ -35,7 +35,7 @@ class Partner(models.Model): field_name = re_match.group()[2:-2] field_pos = re_match.start() if field_name not in street_fields: - raise UserError(_("Unrecognized field %s in street format.") % field_name) + raise UserError(_("Unrecognized field %s in street format.", field_name)) if not previous_field: # first iteration: add heading chars in street_format if partner[field_name]: @@ -104,7 +104,7 @@ class Partner(models.Model): # value not found: keep looking for the same field pass if field_name not in street_fields: - raise UserError(_("Unrecognized field %s in street format.") % field_name) + raise UserError(_("Unrecognized field %s in street format.", field_name)) previous_pos = re_match.end() # last field value is what remains in street_raw minus trailing chars in street_format diff --git a/addons/base_gengo/wizard/base_gengo_translations.py b/addons/base_gengo/wizard/base_gengo_translations.py index 72d23c5ad2d..7f070c00135 100644 --- a/addons/base_gengo/wizard/base_gengo_translations.py +++ b/addons/base_gengo/wizard/base_gengo_translations.py @@ -91,7 +91,7 @@ class BaseGengoTranslations(models.TransientModel): return (True, gengo) except Exception as e: _logger.exception('Gengo connection failed') - return (False, _("Gengo connection failed with this message:\n``%s``") % e) + return (False, _("Gengo connection failed with this message:\n``%s``", e)) def act_update(self): ''' diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py index 041d5ef2dd1..d126bb4268e 100644 --- a/addons/base_import/models/base_import.py +++ b/addons/base_import/models/base_import.py @@ -297,7 +297,7 @@ class Import(models.TransientModel): _("Invalid cell value at row %(row)s, column %(col)s: %(cell_value)s") % { 'row': rowx, 'col': colx, - 'cell_value': xlrd.error_text_from_code.get(cell.value, _("unknown error code %s") % cell.value) + 'cell_value': xlrd.error_text_from_code.get(cell.value, _("unknown error code %s", cell.value)) } ) else: @@ -856,13 +856,13 @@ class Import(models.TransientModel): response.raise_for_status() if response.headers.get('Content-Length') and int(response.headers['Content-Length']) > maxsize: - raise ValueError(_("File size exceeds configured maximum (%s bytes)") % maxsize) + raise ValueError(_("File size exceeds configured maximum (%s bytes)", maxsize)) content = bytearray() for chunk in response.iter_content(DEFAULT_IMAGE_CHUNK_SIZE): content += chunk if len(content) > maxsize: - raise ValueError(_("File size exceeds configured maximum (%s bytes)") % maxsize) + raise ValueError(_("File size exceeds configured maximum (%s bytes)", maxsize)) image = Image.open(io.BytesIO(content)) w, h = image.size diff --git a/addons/base_import_module/controllers/main.py b/addons/base_import_module/controllers/main.py index d382d360961..1671798c20c 100644 --- a/addons/base_import_module/controllers/main.py +++ b/addons/base_import_module/controllers/main.py @@ -30,7 +30,7 @@ class ImportModule(Controller): @webservice def login_upload(self, login, password, db=None, force='', mod_file=None, **kw): if db and db != request.db: - raise Exception(_("Could not select database '%s'") % db) + raise Exception(_("Could not select database '%s'", db)) uid = request.session.authenticate(request.db, login, password) self.check_user(uid) force = True if force == '1' else False diff --git a/addons/base_import_module/models/ir_module.py b/addons/base_import_module/models/ir_module.py index 9fff8448ffd..9e2116507a6 100644 --- a/addons/base_import_module/models/ir_module.py +++ b/addons/base_import_module/models/ir_module.py @@ -121,7 +121,7 @@ class IrModule(models.Model): with zipfile.ZipFile(module_file, "r") as z: for zf in z.filelist: if zf.file_size > MAX_FILE_SIZE: - raise UserError(_("File '%s' exceed maximum allowed file size") % zf.filename) + raise UserError(_("File '%s' exceed maximum allowed file size", zf.filename)) with tempfile.TemporaryDirectory() as module_dir: import odoo.modules.module as module diff --git a/addons/base_sparse_field/models/models.py b/addons/base_sparse_field/models/models.py index 1991306a631..179f6fbdc36 100644 --- a/addons/base_sparse_field/models/models.py +++ b/addons/base_sparse_field/models/models.py @@ -32,9 +32,9 @@ class IrModelFields(models.Model): if 'serialization_field_id' in vals or 'name' in vals: for field in self: if 'serialization_field_id' in vals and field.serialization_field_id.id != vals['serialization_field_id']: - raise UserError(_('Changing the storing system for field "%s" is not allowed.') % field.name) + raise UserError(_('Changing the storing system for field "%s" is not allowed.', field.name)) if field.serialization_field_id and (field.name != vals['name']): - raise UserError(_('Renaming sparse field "%s" is not allowed') % field.name) + raise UserError(_('Renaming sparse field "%s" is not allowed', field.name)) return super(IrModelFields, self).write(vals) diff --git a/addons/calendar/models/calendar_recurrence.py b/addons/calendar/models/calendar_recurrence.py index 9ae8c4fc3de..73c671c611a 100644 --- a/addons/calendar/models/calendar_recurrence.py +++ b/addons/calendar/models/calendar_recurrence.py @@ -127,9 +127,9 @@ class RecurrenceRule(models.Model): every = _("Every %s %s, ") % (recurrence.interval, period) if recurrence.end_type == 'count': - end = _("for %s events") % recurrence.count + end = _("for %s events", recurrence.count) elif recurrence.end_type == 'end_date': - end = _("until %s") % recurrence.until + end = _("until %s", recurrence.until) else: end = '' @@ -142,7 +142,7 @@ class RecurrenceRule(models.Model): weekday_label = dict(BYDAY_SELECTION)[recurrence.byday] on = _("on the %(position)s %(weekday)s, ") % {'position': recurrence.byday, 'weekday': weekday_label} else: - on = _("day %s, ") % recurrence.day + on = _("day %s, ", recurrence.day) else: on = '' recurrence.name = every + on + end diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py index d303623bb6e..10fd1d9cea4 100644 --- a/addons/delivery/models/sale_order.py +++ b/addons/delivery/models/sale_order.py @@ -101,7 +101,7 @@ class SaleOrder(models.Model): } if carrier.invoice_policy == 'real': values['price_unit'] = 0 - values['name'] += _(' (Estimated Cost: %s )') % self._format_currency_amount(price_unit) + values['name'] += _(' (Estimated Cost: %s )', self._format_currency_amount(price_unit)) else: values['price_unit'] = price_unit if carrier.free_over and self.currency_id.is_zero(price_unit) : diff --git a/addons/event/models/event_ticket.py b/addons/event/models/event_ticket.py index 3e96eb78d8c..598179d2070 100644 --- a/addons/event/models/event_ticket.py +++ b/addons/event/models/event_ticket.py @@ -51,7 +51,7 @@ class EventTicket(models.Model): def default_get(self, fields): res = super(EventTicket, self).default_get(fields) if 'name' in fields and (not res.get('name') or res['name'] == _('Registration')) and self.env.context.get('default_event_name'): - res['name'] = _('Registration for %s') % self.env.context['default_event_name'] + res['name'] = _('Registration for %s', self.env.context['default_event_name']) return res # description diff --git a/addons/fetchmail/models/fetchmail.py b/addons/fetchmail/models/fetchmail.py index 67dce8c145b..da83677a02c 100644 --- a/addons/fetchmail/models/fetchmail.py +++ b/addons/fetchmail/models/fetchmail.py @@ -126,7 +126,7 @@ odoo_mailgate: "|/path/to/odoo-mailgate.py --host=localhost -u %(uid)d -p PASSWO server.write({'state': 'done'}) except Exception as err: _logger.info("Failed to connect to %s server %s.", server.server_type, server.name, exc_info=True) - raise UserError(_("Connection test failed: %s") % tools.ustr(err)) + raise UserError(_("Connection test failed: %s", tools.ustr(err))) finally: try: if connection: diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index c424a8c4b28..72fcf48ebad 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -596,7 +596,7 @@ class Challenge(models.Model): def accept_challenge(self): user = self.env.user sudoed = self.sudo() - sudoed.message_post(body=_("%s has joined the challenge") % user.name) + sudoed.message_post(body=_("%s has joined the challenge", user.name)) sudoed.write({'invited_user_ids': [(3, user.id)], 'user_ids': [(4, user.id)]}) return sudoed._generate_goals_from_challenge() @@ -604,7 +604,7 @@ class Challenge(models.Model): """The user discard the suggested challenge""" user = self.env.user sudoed = self.sudo() - sudoed.message_post(body=_("%s has refused the challenge") % user.name) + sudoed.message_post(body=_("%s has refused the challenge", user.name)) return sudoed.write({'invited_user_ids': (3, user.id)}) def _check_challenge_reward(self, force=False): @@ -652,7 +652,7 @@ class Challenge(models.Model): if challenge_ended: # open chatter message - message_body = _("The challenge %s is finished.") % challenge.name + message_body = _("The challenge %s is finished.", challenge.name) if rewarded_users: user_names = rewarded_users.name_get() diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py index 9a14a1438c3..2236a5baa45 100644 --- a/addons/gamification/models/goal.py +++ b/addons/gamification/models/goal.py @@ -430,7 +430,7 @@ class Goal(models.Model): if self.computation_mode == 'manually': # open a wizard window to update the value manually action = { - 'name': _("Update %s") % self.definition_id.name, + 'name': _("Update %s", self.definition_id.name), 'id': self.id, 'type': 'ir.actions.act_window', 'views': [[False, 'form']], diff --git a/addons/google_calendar/models/res_users.py b/addons/google_calendar/models/res_users.py index c2d2dfaf9ac..416cc9f8667 100644 --- a/addons/google_calendar/models/res_users.py +++ b/addons/google_calendar/models/res_users.py @@ -74,7 +74,7 @@ class User(models.Model): with self.pool.cursor() as cr: self.env.user.with_env(self.env(cr=cr)).write({'google_calendar_rtoken': False}) error_key = error.response.json().get("error", "nc") - error_msg = _("Something went wrong during your token generation. Maybe your Authorization Code is invalid or already expired [%s]") % error_key + error_msg = _("Something went wrong during your token generation. Maybe your Authorization Code is invalid or already expired [%s]", error_key) raise UserError(error_msg) def _sync_google_calendar(self, calendar_service: GoogleCalendarService): diff --git a/addons/hr/models/hr_plan.py b/addons/hr/models/hr_plan.py index a9361f531ac..47b4ecc9ef5 100644 --- a/addons/hr/models/hr_plan.py +++ b/addons/hr/models/hr_plan.py @@ -34,24 +34,24 @@ class HrPlanActivityType(models.Model): def get_responsible_id(self, employee): if self.responsible == 'coach': if not employee.coach_id: - raise UserError(_('Coach of employee %s is not set.') % employee.name) + raise UserError(_('Coach of employee %s is not set.', employee.name)) responsible = employee.coach_id.user_id if not responsible: - raise UserError(_('User of coach of employee %s is not set.') % employee.name) + raise UserError(_('User of coach of employee %s is not set.', employee.name)) elif self.responsible == 'manager': if not employee.parent_id: - raise UserError(_('Manager of employee %s is not set.') % employee.name) + raise UserError(_('Manager of employee %s is not set.', employee.name)) responsible = employee.parent_id.user_id if not responsible: - raise UserError(_('User of manager of employee %s is not set.') % employee.name) + raise UserError(_('User of manager of employee %s is not set.', employee.name)) elif self.responsible == 'employee': responsible = employee.user_id if not responsible: - raise UserError(_('User linked to employee %s is required.') % employee.name) + raise UserError(_('User linked to employee %s is required.', employee.name)) elif self.responsible == 'other': responsible = self.responsible_id if not responsible: - raise UserError(_('No specific user given on activity %s.') % self.activity_type_id.name) + raise UserError(_('No specific user given on activity %s.', self.activity_type_id.name)) return responsible diff --git a/addons/hr_contract/models/hr_contract.py b/addons/hr_contract/models/hr_contract.py index 9e79cd89b32..365f0149288 100644 --- a/addons/hr_contract/models/hr_contract.py +++ b/addons/hr_contract/models/hr_contract.py @@ -144,7 +144,7 @@ class Contract(models.Model): for contract in contracts: contract.activity_schedule( 'mail.mail_activity_data_todo', contract.date_end, - _("The contract of %s is about to expire.") % contract.employee_id.name, + _("The contract of %s is about to expire.", contract.employee_id.name), user_id=contract.hr_responsible_id.id or self.env.uid) contracts.write({'kanban_state': 'blocked'}) diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index 3623eaebd2c..35357ebd49d 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -466,7 +466,7 @@ class Applicant(models.Model): if applicant.job_id: applicant.job_id.write({'no_of_hired_employee': applicant.job_id.no_of_hired_employee + 1}) applicant.job_id.message_post( - body=_('New Employee %s Hired') % applicant.partner_name if applicant.partner_name else applicant.name, + body=_('New Employee %s Hired', applicant.partner_name if applicant.partner_name else applicant.name), subtype_xmlid="hr_recruitment.mt_job_applicant_hired") applicant.message_post_with_view( 'hr_recruitment.applicant_hired_template', diff --git a/addons/hw_drivers/iot_handlers/drivers/SerialBaseDriver.py b/addons/hw_drivers/iot_handlers/drivers/SerialBaseDriver.py index 481a11d1309..37a63f57548 100644 --- a/addons/hw_drivers/iot_handlers/drivers/SerialBaseDriver.py +++ b/addons/hw_drivers/iot_handlers/drivers/SerialBaseDriver.py @@ -142,7 +142,7 @@ class SerialDriver(Driver): self._take_measure() time.sleep(self._protocol.newMeasureDelay) except Exception: - msg = _('Error while reading %s') % self.device_name + msg = _('Error while reading %s', self.device_name) _logger.exception(msg) self._status = {'status': self.STATUS_ERROR, 'message_title': msg, 'message_body': traceback.format_exc()} self._push_status() diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py index 34911b8a42b..3bd79296faa 100644 --- a/addons/iap/models/iap.py +++ b/addons/iap/models/iap.py @@ -68,7 +68,7 @@ def jsonrpc(url, method='call', params=None, timeout=15): return response.get('result') except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema, requests.exceptions.Timeout, requests.exceptions.HTTPError) as e: raise exceptions.AccessError( - _('The url that this service requested returned an error. Please contact the author of the app. The url it tried to contact was %s') % url + _('The url that this service requested returned an error. Please contact the author of the app. The url it tried to contact was %s', url) ) #---------------------------------------------------------- diff --git a/addons/im_livechat/models/mail_channel.py b/addons/im_livechat/models/mail_channel.py index a1110b30c4b..783e576e71f 100644 --- a/addons/im_livechat/models/mail_channel.py +++ b/addons/im_livechat/models/mail_channel.py @@ -207,7 +207,7 @@ class MailChannel(models.Model): mail_body = template._render(render_context, engine='ir.qweb', minimal_qcontext=True) mail_body = self.env['mail.render.mixin']._replace_local_links(mail_body) mail = self.env['mail.mail'].sudo().create({ - 'subject': _('Conversation with %s') % self.livechat_operator_id.name, + 'subject': _('Conversation with %s', self.livechat_operator_id.name), 'email_from': company.catchall_formatted or company.email_formatted, 'author_id': self.env.user.partner_id.id, 'email_to': email, diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py index 178f5644f34..5184de1cb8d 100644 --- a/addons/l10n_ar/models/account_move.py +++ b/addons/l10n_ar/models/account_move.py @@ -98,7 +98,7 @@ class AccountMove(models.Model): for line in inv.mapped('invoice_line_ids').filtered(lambda x: x.display_type not in ('line_section', 'line_note')): vat_taxes = line.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code) if len(vat_taxes) != 1: - raise UserError(_('There must be one and only one VAT tax per line. Check line "%s"') % line.name) + raise UserError(_('There must be one and only one VAT tax per line. Check line "%s"', line.name)) elif purchase_aliquots == 'zero' and vat_taxes.tax_group_id.l10n_ar_vat_afip_code != '0': raise UserError(_('On invoice id "%s" you must use VAT Not Applicable on every line.') % inv.id) elif purchase_aliquots == 'not_zero' and vat_taxes.tax_group_id.l10n_ar_vat_afip_code == '0': diff --git a/addons/l10n_ar/models/res_partner.py b/addons/l10n_ar/models/res_partner.py index 50adb05dc1f..68bb218730b 100644 --- a/addons/l10n_ar/models/res_partner.py +++ b/addons/l10n_ar/models/res_partner.py @@ -103,10 +103,10 @@ class ResPartner(models.Model): try: module.validate(rec.vat) except module.InvalidChecksum: - raise ValidationError(_('The validation digit is not valid for "%s"') % rec.l10n_latam_identification_type_id.name) + raise ValidationError(_('The validation digit is not valid for "%s"', rec.l10n_latam_identification_type_id.name)) except module.InvalidLength: - raise ValidationError(_('Invalid length for "%s"') % rec.l10n_latam_identification_type_id.name) + raise ValidationError(_('Invalid length for "%s"', rec.l10n_latam_identification_type_id.name)) except module.InvalidFormat: - raise ValidationError(_('Only numbers allowed for "%s"') % rec.l10n_latam_identification_type_id.name) + raise ValidationError(_('Only numbers allowed for "%s"', rec.l10n_latam_identification_type_id.name)) except Exception as error: raise ValidationError(repr(error)) diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index e09b63e7340..0484c10ce1c 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -88,7 +88,7 @@ class AccountFrFec(models.TransientModel): is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped('code') if not is_dom_tom and not company.vat: raise Warning( - _("Missing VAT number for company %s") % company.name) + _("Missing VAT number for company %s", company.name)) if not is_dom_tom and company.vat[0:2] != 'FR': raise Warning( _("FEC is for French companies only !")) diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index 4e4b6f2d61e..c8b539a5521 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -28,7 +28,7 @@ class pos_session(models.Model): date_today = datetime.utcnow() session_start = Datetime.from_string(self.start_at) if not date_today - timedelta(hours=24) <= session_start: - raise UserError(_("This session has been opened another day. To comply with the French law, you should close sessions on a daily basis. Please close session %s and open a new one.") % self.name) + raise UserError(_("This session has been opened another day. To comply with the French law, you should close sessions on a daily basis. Please close session %s and open a new one.", self.name)) return True def open_frontend_cb(self): diff --git a/addons/l10n_fr_pos_cert/models/res_company.py b/addons/l10n_fr_pos_cert/models/res_company.py index 5cacda61c1d..c701c6f348e 100644 --- a/addons/l10n_fr_pos_cert/models/res_company.py +++ b/addons/l10n_fr_pos_cert/models/res_company.py @@ -64,14 +64,14 @@ class ResCompany(models.Model): ('l10n_fr_secure_sequence_number', '!=', 0)], order="l10n_fr_secure_sequence_number ASC") if not orders: - msg_alert = (_('There isn\'t any order flagged for data inalterability yet for the company %s. This mechanism only runs for point of sale orders generated after the installation of the module France - Certification CGI 286 I-3 bis. - POS') % self.env.company.name) + msg_alert = (_('There isn\'t any order flagged for data inalterability yet for the company %s. This mechanism only runs for point of sale orders generated after the installation of the module France - Certification CGI 286 I-3 bis. - POS', self.env.company.name)) hash_verified = False previous_hash = u'' start_order_info = [] for order in orders: if order.l10n_fr_hash != order._compute_hash(previous_hash=previous_hash): - msg_alert = (_('Corrupted data on point of sale order with id %s.') % order.id) + msg_alert = (_('Corrupted data on point of sale order with id %s.', order.id)) hash_verified = False break previous_hash = order.l10n_fr_hash diff --git a/addons/l10n_id_efaktur/models/account_move.py b/addons/l10n_id_efaktur/models/account_move.py index 2374be57c1f..e19b6d17367 100644 --- a/addons/l10n_id_efaktur/models/account_move.py +++ b/addons/l10n_id_efaktur/models/account_move.py @@ -102,7 +102,7 @@ class AccountMove(models.Model): """Reset E-Faktur, so it can be use for other invoice.""" for move in self: if move.l10n_id_attachment_id: - raise UserError(_('You have already generated the tax report for this document: %s') % move.name) + raise UserError(_('You have already generated the tax report for this document: %s', move.name)) self.env['l10n_id_efaktur.efaktur.range'].push_number(move.company_id.id, move.l10n_id_tax_number[3:]) move.message_post( body='e-Faktur Reset: %s ' % (move.l10n_id_tax_number), diff --git a/addons/l10n_it_edi/models/account_edi_format.py b/addons/l10n_it_edi/models/account_edi_format.py index ab2d7230407..6d52e5cf08e 100644 --- a/addons/l10n_it_edi/models/account_edi_format.py +++ b/addons/l10n_it_edi/models/account_edi_format.py @@ -83,13 +83,13 @@ class AccountEdiFormat(models.Model): else: company = self.env.company if elements: - _logger.info(_('Company not found with codice fiscale: %s. The company\'s user is set by default.') % elements[0].text) + _logger.info(_('Company not found with codice fiscale: %s. The company\'s user is set by default.', elements[0].text)) else: _logger.info(_('Company not found. The company\'s user is set by default.')) if not self.env.is_superuser(): if self.env.company != company: - raise UserError(_("You can only import invoice concern your current company: %s") % self.env.company.display_name) + raise UserError(_("You can only import invoice concern your current company: %s", self.env.company.display_name)) # Refund type. # TD01 == invoice diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py index 62e40420247..3e7c910e7b0 100644 --- a/addons/l10n_it_edi/models/account_invoice.py +++ b/addons/l10n_it_edi/models/account_invoice.py @@ -168,7 +168,7 @@ class AccountMove(models.Model): } data = b"" + invoice._export_as_xml() - description = _('Italian invoice: %s') % invoice.move_type + description = _('Italian invoice: %s', invoice.move_type) invoice.edi_document_ids = self.env['ir.attachment'].create({ 'name': report_name, 'res_id': invoice.id, diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py index 7472a1f79d5..23705dcae76 100644 --- a/addons/l10n_latam_invoice_document/models/account_move.py +++ b/addons/l10n_latam_invoice_document/models/account_move.py @@ -156,7 +156,7 @@ class AccountMove(models.Model): invoice_type = rec.move_type if internal_type in ['debit_note', 'invoice'] and invoice_type in ['out_refund', 'in_refund'] and \ rec.l10n_latam_document_type_id.code != '99': - raise ValidationError(_('You can not use a %s document type with a refund invoice') % internal_type) + raise ValidationError(_('You can not use a %s document type with a refund invoice', internal_type)) elif internal_type == 'credit_note' and invoice_type in ['out_invoice', 'in_invoice']: raise ValidationError(_('You can not use a %s document type with a invoice') % (internal_type)) diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py index 8f3b1694098..46d14831dd5 100644 --- a/addons/mail/controllers/main.py +++ b/addons/mail/controllers/main.py @@ -37,7 +37,7 @@ class MailController(http.Controller): def _check_token_and_record_or_redirect(cls, model, res_id, token): comparison = cls._check_token(token) if not comparison: - _logger.warning(_('Invalid token in route %s') % request.httprequest.url) + _logger.warning(_('Invalid token in route %s', request.httprequest.url)) return comparison, None, cls._redirect_to_messaging() try: record = request.env[model].browse(res_id).exists() diff --git a/addons/mail/models/mail_blacklist.py b/addons/mail/models/mail_blacklist.py index cbe5cc6693b..059c6e9e629 100644 --- a/addons/mail/models/mail_blacklist.py +++ b/addons/mail/models/mail_blacklist.py @@ -28,7 +28,7 @@ class MailBlackList(models.Model): for value in values: email = tools.email_normalize(value.get('email')) if not email: - raise UserError(_('Invalid email address %r') % value['email']) + raise UserError(_('Invalid email address %r', value['email'])) if email in all_emails: continue all_emails.append(email) diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index 1d7c35fabc9..e2ea498ef0e 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -427,7 +427,7 @@ class Channel(models.Model): 'email_from': company.catchall_formatted or company.email_formatted, 'author_id': self.env.user.partner_id.id, 'body_html': view._render({'channel': self, 'partner': partner}, engine='ir.qweb', minimal_qcontext=True), - 'subject': _("Guidelines of channel %s") % self.name, + 'subject': _("Guidelines of channel %s", self.name), 'recipient_ids': [(4, partner.id)] } mail = self.env['mail.mail'].sudo().create(create_values) @@ -976,7 +976,7 @@ class Channel(models.Model): def _execute_command_help(self, **kwargs): partner = self.env.user.partner_id if self.channel_type == 'channel': - msg = _("You are in channel #%s.") % self.name + msg = _("You are in channel #%s.", self.name) if self.public == 'private': msg += _(" This channel is private. People must be invited to join it.") else: diff --git a/addons/mail/models/mail_render_mixin.py b/addons/mail/models/mail_render_mixin.py index ddd32659a03..79b66e55f8b 100644 --- a/addons/mail/models/mail_render_mixin.py +++ b/addons/mail/models/mail_render_mixin.py @@ -316,7 +316,7 @@ class MailRenderMixin(models.AbstractModel): render_result = template.render(variables) except Exception as e: _logger.info("Failed to render template : %s" % e, exc_info=True) - raise UserError(_("Failed to render template : %s") % e) + raise UserError(_("Failed to render template : %s", e)) if render_result == u"False": render_result = u"" results[record.id] = render_result diff --git a/addons/mail/models/mail_template.py b/addons/mail/models/mail_template.py index f8f90aea5fd..92783104b65 100644 --- a/addons/mail/models/mail_template.py +++ b/addons/mail/models/mail_template.py @@ -74,7 +74,7 @@ class MailTemplate(models.Model): @api.returns('self', lambda value: value.id) def copy(self, default=None): default = dict(default or {}, - name=_("%s (copy)") % self.name) + name=_("%s (copy)", self.name)) return super(MailTemplate, self).copy(default=default) def unlink_action(self): @@ -88,7 +88,7 @@ class MailTemplate(models.Model): view = self.env.ref('mail.email_compose_message_wizard_form') for template in self: - button_name = _('Send Mail (%s)') % template.name + button_name = _('Send Mail (%s)', template.name) action = ActWindow.create({ 'name': button_name, 'type': 'ir.actions.act_window', @@ -200,7 +200,7 @@ class MailTemplate(models.Model): else: res = report._render([res_id]) if not res: - raise UserError(_('Unsupported report type %s found.') % report.report_type) + raise UserError(_('Unsupported report type %s found.', report.report_type)) result, format = res # TODO in trunk, change return format to binary to match message_post expected format diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index ee16931f25e..3f8818bc386 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -544,7 +544,7 @@ class MailThread(models.AbstractModel): """ self.ensure_one() doc_name = self.env['ir.model']._get(self._name).name - return _('%s created') % doc_name + return _('%s created', doc_name) def _track_subtype(self, init_values): """ Give the subtypes triggered by the changes on the record according @@ -671,7 +671,7 @@ class MailThread(models.AbstractModel): def _routing_warn(self, error_message, message_id, route, raise_exception=True): """ Tools method used in _routing_check_route: whether to log a warning or raise an error """ - short_message = _("Mailbox unavailable - %s") % error_message + short_message = _("Mailbox unavailable - %s", error_message) full_message = ('Routing mail with Message-Id %s: route %s: %s' % (message_id, route, error_message)) _logger.info(full_message) @@ -791,7 +791,7 @@ class MailThread(models.AbstractModel): self._routing_warn(_('target model unspecified'), message_id, route, raise_exception) return () elif model not in self.env: - self._routing_warn(_('unknown target model %s') % model, message_id, route, raise_exception) + self._routing_warn(_('unknown target model %s', model), message_id, route, raise_exception) return () record_set = self.env[model].browse(thread_id) if thread_id else self.env[model] @@ -801,12 +801,12 @@ class MailThread(models.AbstractModel): self._routing_warn(_('reply to missing document (%s,%s), fall back on document creation') % (model, thread_id), message_id, route, False) thread_id = None elif not hasattr(record_set, 'message_update'): - self._routing_warn(_('reply to model %s that does not accept document update, fall back on document creation') % model, message_id, route, False) + self._routing_warn(_('reply to model %s that does not accept document update, fall back on document creation', model), message_id, route, False) thread_id = None # New Document: check model accepts the mailgateway if not thread_id and model and not hasattr(record_set, 'message_new'): - self._routing_warn(_('model %s does not accept document creation') % model, message_id, route, raise_exception) + self._routing_warn(_('model %s does not accept document creation', model), message_id, route, raise_exception) return () # Update message author. We do it now because we need it for aliases (contact settings) @@ -2595,7 +2595,7 @@ class MailThread(models.AbstractModel): access_link = self._notify_get_action_link('view') if model_name: - view_title = _('View %s') % model_name + view_title = _('View %s', model_name) else: view_title = _('View') @@ -2859,7 +2859,7 @@ class MailThread(models.AbstractModel): assignation_msg = view._render(values, engine='ir.qweb', minimal_qcontext=True) assignation_msg = self.env['mail.render.mixin']._replace_local_links(assignation_msg) record.message_notify( - subject=_('You have been assigned to %s') % record.display_name, + subject=_('You have been assigned to %s', record.display_name), body=assignation_msg, partner_ids=partner_ids, record_name=record.display_name, diff --git a/addons/mail/models/mail_thread_blacklist.py b/addons/mail/models/mail_thread_blacklist.py index 00f6bb95518..f17302f360e 100644 --- a/addons/mail/models/mail_thread_blacklist.py +++ b/addons/mail/models/mail_thread_blacklist.py @@ -93,9 +93,9 @@ class MailBlackListMixin(models.AbstractModel): def _assert_primary_email(self): if not hasattr(self, "_primary_email") or not isinstance(self._primary_email, str): - raise UserError(_('Invalid primary email field on model %s') % self._name) + raise UserError(_('Invalid primary email field on model %s', self._name)) if self._primary_email not in self._fields or self._fields[self._primary_email].type != 'char': - raise UserError(_('Invalid primary email field on model %s') % self._name) + raise UserError(_('Invalid primary email field on model %s', self._name)) def _message_receive_bounce(self, email, partner): """ Override of mail.thread generic method. Purpose is to increment the diff --git a/addons/maintenance/models/maintenance.py b/addons/maintenance/models/maintenance.py index 49d27a2b182..8224cc52d93 100644 --- a/addons/maintenance/models/maintenance.py +++ b/addons/maintenance/models/maintenance.py @@ -223,7 +223,7 @@ class MaintenanceEquipment(models.Model): def _create_new_request(self, date): self.ensure_one() self.env['maintenance.request'].create({ - 'name': _('Preventive Maintenance - %s') % self.name, + 'name': _('Preventive Maintenance - %s', self.name), 'request_date': date, 'schedule_date': date, 'category_id': self.category_id.id, diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 31c2acc8dc3..7146c1cc77d 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -259,7 +259,7 @@ class MassMailing(models.Model): def copy(self, default=None): self.ensure_one() default = dict(default or {}, - name=_('%s (copy)') % self.name, + name=_('%s (copy)', self.name), contact_list_ids=self.contact_list_ids.ids) return super(MassMailing, self).copy(default=default) @@ -469,7 +469,7 @@ class MassMailing(models.Model): elif 'email' in target._fields: mail_field = 'email' else: - raise UserError(_("Unsupported mass mailing model %s") % self.mailing_model_id.name) + raise UserError(_("Unsupported mass mailing model %s", self.mailing_model_id.name)) if self.unique_ab_testing: query +=""" diff --git a/addons/mass_mailing_sms/models/mailing_mailing.py b/addons/mass_mailing_sms/models/mailing_mailing.py index 3893f11a091..cd0e6060f6f 100644 --- a/addons/mass_mailing_sms/models/mailing_mailing.py +++ b/addons/mass_mailing_sms/models/mailing_mailing.py @@ -171,7 +171,7 @@ class Mailing(models.Model): if 'phone' in target._fields: phone_fields.append('phone') if not phone_fields: - raise UserError(_("Unsupported %s for mass SMS") % self.mailing_model_id.name) + raise UserError(_("Unsupported %s for mass SMS", self.mailing_model_id.name)) query = """ SELECT %(select_query)s diff --git a/addons/mass_mailing_sms/wizard/mailing_sms_test.py b/addons/mass_mailing_sms/wizard/mailing_sms_test.py index c9fe95ec8c5..198304dc2c6 100644 --- a/addons/mass_mailing_sms/wizard/mailing_sms_test.py +++ b/addons/mass_mailing_sms/wizard/mailing_sms_test.py @@ -23,7 +23,7 @@ class MassSMSTest(models.TransientModel): sanitized_numbers = [info['sanitized'] for info in sanitize_res.values() if info['sanitized']] invalid_numbers = [number for number, info in sanitize_res.items() if info['code']] if invalid_numbers: - raise exceptions.UserError(_('Following numbers are not correctly encoded: %s, example : "+32 495 85 85 77, +33 545 55 55 55"') % repr(invalid_numbers)) + raise exceptions.UserError(_('Following numbers are not correctly encoded: %s, example : "+32 495 85 85 77, +33 545 55 55 55"', repr(invalid_numbers))) self.env['sms.api']._send_sms_batch([{ 'res_id': 0, 'number': number, diff --git a/addons/mass_mailing_sms/wizard/sms_composer.py b/addons/mass_mailing_sms/wizard/sms_composer.py index b3e50234036..b8d13b7f056 100644 --- a/addons/mass_mailing_sms/wizard/sms_composer.py +++ b/addons/mass_mailing_sms/wizard/sms_composer.py @@ -45,7 +45,7 @@ class SMSComposer(models.TransientModel): trace_values['ignored'] = fields.Datetime.now() else: if self.mass_sms_allow_unsubscribe: - sms_values['body'] = '%s\n%s' % (sms_values['body'] or '', _('STOP SMS : %s') % self._get_unsubscribe_url(record.id, trace_code, sms_values['number'])) + sms_values['body'] = '%s\n%s' % (sms_values['body'] or '', _('STOP SMS : %s', self._get_unsubscribe_url(record.id, trace_code, sms_values['number']))) return trace_values def _get_blacklist_record_ids(self, records, recipients_info): diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index 6f0603c028f..43bce93cf71 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -90,7 +90,7 @@ class MrpBom(models.Model): for bom in self: for bom_line in bom.bom_line_ids: if bom.product_id and bom_line.product_id == bom.product_id: - raise ValidationError(_("BoM line product %s should not be the same as BoM product.") % bom.display_name) + raise ValidationError(_("BoM line product %s should not be the same as BoM product.", bom.display_name)) if bom.product_id and bom_line.bom_product_template_attribute_value_ids: raise ValidationError(_("BoM cannot concern product %s and have a line with attributes (%s) at the same time.") % (bom.product_id.display_name, ", ".join([ptav.display_name for ptav in bom_line.bom_product_template_attribute_value_ids]))) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 7a58b069198..229d93f5b5d 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -718,7 +718,7 @@ class MrpProduction(models.Model): not_cancel = self.filtered(lambda m: m.state != 'cancel') if not_cancel: productions_name = ', '.join([prod.display_name for prod in not_cancel]) - raise UserError(_('%s cannot be deleted. Try to cancel them before.') % productions_name) + raise UserError(_('%s cannot be deleted. Try to cancel them before.', productions_name)) workorders_to_delete = self.workorder_ids.filtered(lambda wo: wo.state != 'done') if workorders_to_delete: @@ -794,7 +794,7 @@ class MrpProduction(models.Model): moves = [] for production in self: if production.product_id in production.bom_id.byproduct_ids.mapped('product_id'): - raise UserError(_("You cannot have %s as the finished product and in the Byproducts") % self.product_id.name) + raise UserError(_("You cannot have %s as the finished product and in the Byproducts", self.product_id.name)) moves = [production._get_move_finished_values(production.product_id.id, production.product_qty, production.product_uom_id.id)] for byproduct in production.bom_id.byproduct_ids: product_uom_factor = production.product_uom_id._compute_quantity(production.product_qty, production.bom_id.product_uom_id) @@ -1554,7 +1554,7 @@ class MrpProduction(models.Model): def button_unbuild(self): self.ensure_one() return { - 'name': _('Unbuild: %s') % self.product_id.display_name, + 'name': _('Unbuild: %s', self.product_id.display_name), 'view_mode': 'form', 'res_model': 'mrp.unbuild', 'view_id': self.env.ref('mrp.mrp_unbuild_form_view_simplified').id, @@ -1585,7 +1585,7 @@ class MrpProduction(models.Model): ('state', '=', 'done') ]) if sml: - raise UserError(_('This serial number for product %s has already been produced') % self.product_id.name) + raise UserError(_('This serial number for product %s has already been produced', self.product_id.name)) for move in self.move_finished_ids: if move.has_tracking != 'serial' or move.product_id == self.product_id: diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 0c1407c7a44..ad8711bd420 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -751,7 +751,7 @@ class MrpWorkorder(models.Model): qty_done += line.product_uom_id._compute_quantity(line.qty_done, move.product_uom) rounding = move.product_uom_id.rounding if float_compare(qty_done, move.product_uom_qty, precision_rounding=rounding) != 0: - raise UserError(_('You should consume the quantity of %s defined in the BoM. If you want to consume more or less components, change the consumption setting on the BoM.') % move.product_id.name) + raise UserError(_('You should consume the quantity of %s defined in the BoM. If you want to consume more or less components, change the consumption setting on the BoM.', move.product_id.name)) def _check_sn_uniqueness(self): """ Alert the user if the serial number as already been produced """ @@ -763,4 +763,4 @@ class MrpWorkorder(models.Model): ('state', '=', 'done') ]) if sml: - raise UserError(_('This serial number for product %s has already been produced') % self.product_id.name) + raise UserError(_('This serial number for product %s has already been produced', self.product_id.name)) diff --git a/addons/payment_sips/models/payment.py b/addons/payment_sips/models/payment.py index bc44b5c68b0..49dbd5b4dbd 100644 --- a/addons/payment_sips/models/payment.py +++ b/addons/payment_sips/models/payment.py @@ -159,7 +159,7 @@ class TxSips(models.Model): payment_tx = self.search([('reference', '=', reference)]) if not payment_tx or len(payment_tx) > 1: - error_msg = _('Sips: received data for reference %s') % reference + error_msg = _('Sips: received data for reference %s', reference) if not payment_tx: error_msg += _('; no order found') else: diff --git a/addons/payment_stripe/models/payment.py b/addons/payment_stripe/models/payment.py index d13f80bec46..a1a7da752bc 100644 --- a/addons/payment_stripe/models/payment.py +++ b/addons/payment_stripe/models/payment.py @@ -82,7 +82,7 @@ class PaymentAcquirerStripe(models.Model): except HTTPError: _logger.error(resp.text) stripe_error = resp.json().get('error', {}).get('message', '') - error_msg = " " + (_("Stripe gave us the following info about the problem: '%s'") % stripe_error) + error_msg = " " + (_("Stripe gave us the following info about the problem: '%s'", stripe_error)) raise ValidationError(error_msg) return resp.json() @@ -249,7 +249,7 @@ class PaymentTransactionStripe(models.Model): tx = self.search([('reference', '=', reference)]) if not tx: - error_msg = (_('Stripe: no order found for reference %s') % reference) + error_msg = _('Stripe: no order found for reference %s', reference) _logger.error(error_msg) raise ValidationError(error_msg) elif len(tx) > 1: diff --git a/addons/phone_validation/models/mail_thread_phone.py b/addons/phone_validation/models/mail_thread_phone.py index 9b608c8b601..d560de1911a 100644 --- a/addons/phone_validation/models/mail_thread_phone.py +++ b/addons/phone_validation/models/mail_thread_phone.py @@ -106,9 +106,9 @@ class PhoneMixin(models.AbstractModel): def _assert_phone_field(self): if not hasattr(self, "_phone_get_number_fields"): - raise UserError(_('Invalid primary phone field on model %s') % self._name) + raise UserError(_('Invalid primary phone field on model %s', self._name)) if not any(fname in self and self._fields[fname].type == 'char' for fname in self._phone_get_number_fields()): - raise UserError(_('Invalid primary phone field on model %s') % self._name) + raise UserError(_('Invalid primary phone field on model %s', self._name)) def _phone_get_number_fields(self): """ This method returns the fields to use to find the number to use to diff --git a/addons/phone_validation/tools/phone_validation.py b/addons/phone_validation/tools/phone_validation.py index 97eb7bac05c..87fe5498188 100644 --- a/addons/phone_validation/tools/phone_validation.py +++ b/addons/phone_validation/tools/phone_validation.py @@ -20,9 +20,9 @@ try: raise UserError(_('Unable to parse %s.: %s') % (number, str(e))) if not phonenumbers.is_possible_number(phone_nbr): - raise UserError(_('Impossible number %s: probably invalid number of digits.') % number) + raise UserError(_('Impossible number %s: probably invalid number of digits.', number)) if not phonenumbers.is_valid_number(phone_nbr): - raise UserError(_('Invalid number %s: probably incorrect prefix.') % number) + raise UserError(_('Invalid number %s: probably incorrect prefix.', number)) return phone_nbr diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 235c97bb806..d63bced8eb9 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -459,7 +459,7 @@ class PosConfig(models.Model): def create(self, values): IrSequence = self.env['ir.sequence'].sudo() val = { - 'name': _('POS Order %s') % values['name'], + 'name': _('POS Order %s', values['name']), 'padding': 4, 'prefix': "%s/" % values['name'], 'code': "pos.order", @@ -468,7 +468,7 @@ class PosConfig(models.Model): # force sequence_id field to new pos.order sequence values['sequence_id'] = IrSequence.create(val).id - val.update(name=_('POS order line %s') % values['name'], code='pos.order.line') + val.update(name=_('POS order line %s', values['name']), code='pos.order.line') values['sequence_line_id'] = IrSequence.create(val).id pos_config = super(PosConfig, self).create(values) pos_config.sudo()._check_modules_to_install() diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 085ba223a04..ccb05ff7d42 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -363,7 +363,7 @@ class PosOrder(models.Model): total = float_round(self.amount_total, precision_rounding=self.config_id.rounding_method.rounding, rounding_method=self.config_id.rounding_method.rounding_method) if not float_is_zero(total - self.amount_paid, precision_rounding=self.currency_id.rounding): - raise UserError(_("Order %s is not fully paid.") % self.name) + raise UserError(_("Order %s is not fully paid.", self.name)) self.write({'state': 'paid'}) @@ -479,7 +479,7 @@ class PosOrder(models.Model): # order. It can be the same session, or if it has been closed the new one that has been opened. current_session = order.session_id.config_id.current_session_id if not current_session: - raise UserError(_('To return product(s), you need to open a session in the POS %s') % order.session_id.config_id.display_name) + raise UserError(_('To return product(s), you need to open a session in the POS %s', order.session_id.config_id.display_name)) refund_order = order.copy({ 'name': order.name + _(' REFUND'), 'session_id': current_session.id, @@ -533,7 +533,7 @@ class PosOrder(models.Model): 'mimetype': 'image/jpeg', }) mail_values = { - 'subject': _('Receipt %s') % name, + 'subject': _('Receipt %s', name), 'body_html': message, 'author_id': self.env.user.partner_id.id, 'email_from': self.env.company.email or self.env.user.email_formatted, diff --git a/addons/portal/controllers/mail.py b/addons/portal/controllers/mail.py index c64859c1ad6..612191b705e 100644 --- a/addons/portal/controllers/mail.py +++ b/addons/portal/controllers/mail.py @@ -111,7 +111,7 @@ class PortalChatter(http.Controller): try: CustomerPortal._document_check_access(self, 'ir.attachment', attachment_id, access_token) except (AccessError, MissingError): - raise UserError(_("The attachment %s does not exist or you do not have the rights to access it.") % attachment_id) + raise UserError(_("The attachment %s does not exist or you do not have the rights to access it.", attachment_id)) @http.route(['/mail/chatter_post'], type='http', methods=['POST'], auth='public', website=True) def portal_chatter_post(self, res_model, res_id, message, redirect=None, attachment_ids='', attachment_tokens='', **kw): diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index 6bec53e7f74..6034a933e77 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -273,10 +273,10 @@ class CustomerPortal(Controller): raise UserError(_("The attachment does not exist or you do not have the rights to access it.")) if attachment_sudo.res_model != 'mail.compose.message' or attachment_sudo.res_id != 0: - raise UserError(_("The attachment %s cannot be removed because it is not in a pending state.") % attachment_sudo.name) + raise UserError(_("The attachment %s cannot be removed because it is not in a pending state.", attachment_sudo.name)) if attachment_sudo.env['mail.message'].search([('attachment_ids', 'in', attachment_sudo.ids)]): - raise UserError(_("The attachment %s cannot be removed because it is linked to a message.") % attachment_sudo.name) + raise UserError(_("The attachment %s cannot be removed because it is linked to a message.", attachment_sudo.name)) return attachment_sudo.unlink() @@ -364,12 +364,12 @@ class CustomerPortal(Controller): def _show_report(self, model, report_type, report_ref, download=False): if report_type not in ('html', 'pdf', 'text'): - raise UserError(_("Invalid report type: %s") % report_type) + raise UserError(_("Invalid report type: %s", report_type)) report_sudo = request.env.ref(report_ref).sudo() if not isinstance(report_sudo, type(request.env['ir.actions.report'])): - raise UserError(_("%s is not the reference of a report") % report_ref) + raise UserError(_("%s is not the reference of a report", report_ref)) method_name = '_render_qweb_%s' % (report_type) report = getattr(report_sudo, method_name)([model.id], data={'report_type': report_type})[0] diff --git a/addons/pos_adyen/models/pos_config.py b/addons/pos_adyen/models/pos_config.py index b0d9176c628..7578f844ed7 100644 --- a/addons/pos_adyen/models/pos_config.py +++ b/addons/pos_adyen/models/pos_config.py @@ -17,7 +17,7 @@ class PosConfig(models.Model): def _check_adyen_ask_customer_for_tip(self): for config in self: if config.adyen_ask_customer_for_tip and (not config.tip_product_id or not config.iface_tipproduct): - raise ValidationError(_("Please configure a tip product for POS %s to support tipping with Adyen.") % config.name) + raise ValidationError(_("Please configure a tip product for POS %s to support tipping with Adyen.", config.name)) @api.onchange('adyen_ask_customer_for_tip') def _onchange_adyen_ask_customer_for_tip(self): diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index 44ca5b89b23..c30d0c64514 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -19,7 +19,7 @@ class MercuryTransaction(models.Model): def _get_pos_session(self): pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1) if not pos_session: - raise UserError(_("No opened point of sale session for user %s found.") % self.env.user.name) + raise UserError(_("No opened point of sale session for user %s found.", self.env.user.name)) pos_session.login() diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index 880766ce545..1b2b0640284 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -519,7 +519,7 @@ class PricelistItem(models.Model): ), ) elif item.compute_price == 'percentage': - item.price = _("%s %% discount") % (item.percent_price) + item.price = _("%s %% discount", item.percent_price) else: item.price = _("%s %% discount and %s surcharge") % (item.price_discount, item.price_surcharge) diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index cb9cd14ee32..8da67700c14 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -436,7 +436,7 @@ class ProductTemplate(models.Model): if default is None: default = {} if 'name' not in default: - default['name'] = _("%s (copy)") % self.name + default['name'] = _("%s (copy)", self.name) return super(ProductTemplate, self).copy(default=default) def name_get(self): diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 70c5f58f4dc..dee727dfcfb 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -639,7 +639,7 @@ class Task(models.Model): portal_users = task.allowed_user_ids.filtered('share') if portal_users: user_names = ', '.join(portal_users[:10].mapped('name')) - raise ValidationError(_("The project visibility setting doesn't allow portal users to see the project's tasks. (%s)") % user_names) + raise ValidationError(_("The project visibility setting doesn't allow portal users to see the project's tasks. (%s)", user_names)) def _compute_attachment_ids(self): for task in self: @@ -752,7 +752,7 @@ class Task(models.Model): if default is None: default = {} if not default.get('name'): - default['name'] = _("%s (copy)") % self.name + default['name'] = _("%s (copy)", self.name) return super(Task, self).copy(default) @api.constrains('parent_id') diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index e2d254d56fe..7afe483ceaa 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -284,7 +284,7 @@ class PurchaseOrder(models.Model): # Block if partner only has warning but parent company is blocked if partner.purchase_warn != 'block' and partner.parent_id and partner.parent_id.purchase_warn == 'block': partner = partner.parent_id - title = _("Warning for %s") % partner.name + title = _("Warning for %s", partner.name) message = partner.purchase_warn_msg warning = { 'title': title, @@ -721,7 +721,7 @@ class PurchaseOrder(models.Model): def _compose_note(self, updated_dates): """Helper method for creating log note when user update scheduled date on portal website.""" - note = _('

%s modified receipt dates for the following products:

') % self.partner_id.name + note = _('

%s modified receipt dates for the following products:

', self.partner_id.name) for line, date in updated_dates: note += _('

  - %s from %s to %s

') % (line.product_id.display_name, line.date_planned, date) return note @@ -980,7 +980,7 @@ class PurchaseOrderLine(models.Model): product_info = self.product_id if product_info.purchase_line_warn != 'no-message': - title = _("Warning for %s") % product_info.name + title = _("Warning for %s", product_info.name) message = product_info.purchase_line_warn_msg warning['title'] = title warning['message'] = message diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py index 0ee207103c4..0a4e042a6e4 100644 --- a/addons/purchase_requisition/models/purchase_requisition.py +++ b/addons/purchase_requisition/models/purchase_requisition.py @@ -89,7 +89,7 @@ class PurchaseRequisition(models.Model): ('company_id', '=', self.company_id.id), ]) if any(requisitions): - title = _("Warning for %s") % self.vendor_id.name + title = _("Warning for %s", self.vendor_id.name) message = _("There is already an open blanket order for this supplier. We suggest you to use to complete this open blanket order instead of creating a new one.") warning = { 'title': title, @@ -115,7 +115,7 @@ class PurchaseRequisition(models.Model): def action_in_progress(self): self.ensure_one() if not all(obj.line_ids for obj in self): - raise UserError(_("You cannot confirm agreement '%s' because there is no product line.") % self.name) + raise UserError(_("You cannot confirm agreement '%s' because there is no product line.", self.name)) if self.type_id.quantity_copy == 'none' and self.vendor_id: for requisition_line in self.line_ids: if requisition_line.price_unit <= 0.0: diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index 67fa411ed57..7d4e80430f3 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -218,7 +218,7 @@ class PurchaseOrder(models.Model): 'partner_id': self.partner_id.id }) if not self.partner_id.property_stock_supplier.id: - raise UserError(_("You must set a Vendor Location for this partner %s") % self.partner_id.name) + raise UserError(_("You must set a Vendor Location for this partner %s", self.partner_id.name)) return { 'picking_type_id': self.picking_type_id.id, 'partner_id': self.partner_id.id, @@ -258,9 +258,9 @@ class PurchaseOrder(models.Model): validated_picking = self.picking_ids.filtered(lambda p: p.state == 'done') if validated_picking: - note += _("

Those dates couldn’t be modified accordingly on the receipt %s which had already been validated.

") % validated_picking.name + note += _("

Those dates couldn’t be modified accordingly on the receipt %s which had already been validated.

", validated_picking.name) else: - note += _("

Those dates have been updated accordingly on the receipt %s.

") % self.picking_ids[0].name + note += _("

Those dates have been updated accordingly on the receipt %s.

", self.picking_ids[0].name) for line, date in updated_dates: date = datetime.strptime(date, '%Y-%m-%d %H:%M:%S') line._update_date_planned(date) diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index 9e1d2ce85d3..f6a6aa25747 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -360,7 +360,7 @@ class Repair(models.Model): account = operation.product_id.product_tmpl_id._get_product_accounts()['income'] if not account: - raise UserError(_('No account defined for product "%s".') % operation.product_id.name) + raise UserError(_('No account defined for product "%s".', operation.product_id.name)) invoice_line_vals = { 'name': name, @@ -402,7 +402,7 @@ class Repair(models.Model): account = fee.product_id.product_tmpl_id._get_product_accounts()['income'] if not account: - raise UserError(_('No account defined for product "%s".') % fee.product_id.name) + raise UserError(_('No account defined for product "%s".', fee.product_id.name)) invoice_line_vals = { 'name': name, diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index 7c497a61856..e590bdc0643 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -160,7 +160,7 @@ class ResourceCalendar(models.Model): def default_get(self, fields): res = super(ResourceCalendar, self).default_get(fields) if not res.get('name') and res.get('company_id'): - res['name'] = _('Working Hours of %s') % self.env['res.company'].browse(res['company_id']).name + res['name'] = _('Working Hours of %s', self.env['res.company'].browse(res['company_id']).name) if 'attendance_ids' in fields and not res.get('attendance_ids'): res['attendance_ids'] = [ (0, 0, {'name': _('Monday Morning'), 'dayofweek': '0', 'hour_from': 8, 'hour_to': 12, 'day_period': 'morning'}), diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index 40e854af7c5..868235fde64 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -160,7 +160,7 @@ class CustomerPortal(CustomerPortal): session_obj_date = request.session.get('view_quote_%s' % order_sudo.id) if session_obj_date != now and request.env.user.share and access_token: request.session['view_quote_%s' % order_sudo.id] = now - body = _('Quotation viewed by customer %s') % order_sudo.partner_id.name + body = _('Quotation viewed by customer %s', order_sudo.partner_id.name) _message_post_helper( "sale.order", order_sudo.id, diff --git a/addons/sale/models/account_invoice.py b/addons/sale/models/account_invoice.py index 5a9667330ea..c02f918e333 100644 --- a/addons/sale/models/account_invoice.py +++ b/addons/sale/models/account_invoice.py @@ -96,7 +96,7 @@ class AccountMove(models.Model): for sale_line in line.sale_line_ids: todo.add((sale_line.order_id, invoice.name)) for (order, name) in todo: - order.message_post(body=_("Invoice %s paid") % name) + order.message_post(body=_("Invoice %s paid", name)) return res def _get_invoice_delivery_partner_id(self): diff --git a/addons/sale/models/payment.py b/addons/sale/models/payment.py index 30d63d02cec..4904f51e396 100644 --- a/addons/sale/models/payment.py +++ b/addons/sale/models/payment.py @@ -83,7 +83,7 @@ class PaymentTransaction(models.Model): order.amount_total, self.amount, ) order.message_post( - subject=_("Amount Mismatch (%s)") % self.acquirer_id.provider, + subject=_("Amount Mismatch (%s)", self.acquirer_id.provider), body=_("The order was not confirmed despite response from the acquirer (%s): order total is %r but acquirer replied with %r.") % ( self.acquirer_id.provider, order.amount_total, diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index cd6abfd9f5e..aba5569b04c 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -449,7 +449,7 @@ class SaleOrder(models.Model): lines_to_update.append((1, line.id, {'price_unit': price_unit})) self.update({'order_line': lines_to_update}) self.show_update_pricelist = False - self.message_post(body=_("Product prices have been recomputed according to pricelist %s ") % self.pricelist_id.display_name) + self.message_post(body=_("Product prices have been recomputed according to pricelist %s ", self.pricelist_id.display_name)) @api.model def create(self, vals): @@ -1595,7 +1595,7 @@ class SaleOrderLine(models.Model): result = {} warning = {} if product.sale_line_warn != 'no-message': - title = _("Warning for %s") % product.name + title = _("Warning for %s", product.name) message = product.sale_line_warn_msg warning['title'] = title warning['message'] = message diff --git a/addons/sale_timesheet/models/project.py b/addons/sale_timesheet/models/project.py index da7a5926053..b31f89dad69 100644 --- a/addons/sale_timesheet/models/project.py +++ b/addons/sale_timesheet/models/project.py @@ -110,7 +110,7 @@ class Project(models.Model): return self.action_view_timesheet_plan() return { 'type': 'ir.actions.act_window', - 'name': _('Timesheets of %s') % self.name, + 'name': _('Timesheets of %s', self.name), 'domain': [('project_id', '!=', False)], 'res_model': 'account.analytic.line', 'view_id': False, diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py index ef919653fea..e26a05abe7f 100644 --- a/addons/sales_team/models/crm_team.py +++ b/addons/sales_team/models/crm_team.py @@ -133,7 +133,7 @@ class CrmTeam(models.Model): def _graph_get_model(self): """ skeleton function defined here because it'll be called by crm and/or sale """ - raise UserError(_('Undefined graph model for Sales Team: %s') % self.name) + raise UserError(_('Undefined graph model for Sales Team: %s', self.name)) def _graph_get_dates(self, today): """ return a coherent start and end date for the dashboard graph covering a month period grouped by week. @@ -151,7 +151,7 @@ class CrmTeam(models.Model): return 'EXTRACT(WEEK FROM %s)' % self._graph_date_column() def _graph_y_query(self): - raise UserError(_('Undefined graph model for Sales Team: %s') % self.name) + raise UserError(_('Undefined graph model for Sales Team: %s', self.name)) def _extra_sql_conditions(self): return '' diff --git a/addons/sms/models/sms_template.py b/addons/sms/models/sms_template.py index fb5b8877e87..f3e777f77c4 100644 --- a/addons/sms/models/sms_template.py +++ b/addons/sms/models/sms_template.py @@ -32,7 +32,7 @@ class SMSTemplate(models.Model): @api.returns('self', lambda value: value.id) def copy(self, default=None): default = dict(default or {}, - name=_("%s (copy)") % self.name) + name=_("%s (copy)", self.name)) return super(SMSTemplate, self).copy(default=default) def unlink(self): @@ -44,7 +44,7 @@ class SMSTemplate(models.Model): view = self.env.ref('sms.sms_composer_view_form') for template in self: - button_name = _('Send SMS (%s)') % template.name + button_name = _('Send SMS (%s)', template.name) action = ActWindow.create({ 'name': button_name, 'type': 'ir.actions.act_window', diff --git a/addons/sms/wizard/sms_composer.py b/addons/sms/wizard/sms_composer.py index 0d3d822ed4b..7467d99a21a 100644 --- a/addons/sms/wizard/sms_composer.py +++ b/addons/sms/wizard/sms_composer.py @@ -155,7 +155,7 @@ class SendSMS(models.TransientModel): sanitized_numbers = [info['sanitized'] for info in sanitize_res.values() if info['sanitized']] invalid_numbers = [number for number, info in sanitize_res.items() if info['code']] if invalid_numbers: - raise UserError(_('Following numbers are not correctly encoded: %s') % repr(invalid_numbers)) + raise UserError(_('Following numbers are not correctly encoded: %s', repr(invalid_numbers))) composer.sanitized_numbers = ','.join(sanitized_numbers) else: composer.sanitized_numbers = False @@ -193,7 +193,7 @@ class SendSMS(models.TransientModel): if self.comment_single_recipient and not self.recipient_single_valid: raise UserError(_('Invalid recipient number. Please update it.')) elif not self.comment_single_recipient and self.recipient_invalid_count: - raise UserError(_('%s invalid recipients') % self.recipient_invalid_count) + raise UserError(_('%s invalid recipients', self.recipient_invalid_count)) self._action_send_sms() return False diff --git a/addons/snailmail_account/wizard/account_invoice_send.py b/addons/snailmail_account/wizard/account_invoice_send.py index c4c74f9b9df..d694ca56586 100644 --- a/addons/snailmail_account/wizard/account_invoice_send.py +++ b/addons/snailmail_account/wizard/account_invoice_send.py @@ -80,7 +80,7 @@ class AccountInvoiceSend(models.TransientModel): self.env['bus.bus'].sendone( (self._cr.dbname, 'res.partner', self.env.user.partner_id.id), {'type': 'snailmail_invalid_address', 'title': _("Invalid Addresses"), - 'message': _("%s of the selected invoice(s) had an invalid address and were not sent") % self.invalid_addresses} + 'message': _("%s of the selected invoice(s) had an invalid address and were not sent", self.invalid_addresses)} ) def invalid_addresses_action(self): diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index ea9529e58b3..b7f9ce7e06c 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -329,11 +329,11 @@ class Product(models.Model): # TDE FIXME: should probably clean the search methods # to prevent sql injections if field not in ('qty_available', 'virtual_available', 'incoming_qty', 'outgoing_qty', 'free_qty'): - raise UserError(_('Invalid domain left operand %s') % field) + raise UserError(_('Invalid domain left operand %s', field)) if operator not in ('<', '>', '=', '!=', '<=', '>='): - raise UserError(_('Invalid domain operator %s') % operator) + raise UserError(_('Invalid domain operator %s', operator)) if not isinstance(value, (float, int)): - raise UserError(_('Invalid domain right operand %s') % value) + raise UserError(_('Invalid domain right operand %s', value)) # TODO: Still optimization possible when searching virtual quantities ids = [] diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 8155141c7ca..7256e54c5e6 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -499,7 +499,7 @@ class StockMove(models.Model): return msg = _("The scheduled date has been automatically updated due to a delay on %s.") % (doc_orig[0]._name, doc_orig[0].id, doc_orig[0].name) - msg_subject = _("Scheduled date update due to delay on %s") % doc_orig[0].name + msg_subject = _("Scheduled date update due to delay on %s", doc_orig[0].name) # write the message on each document for doc in documents: last_message = doc.message_ids[:1] diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 7e0f88d6b36..0ba3384d755 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -157,7 +157,7 @@ class StockMoveLine(models.Model): if self.qty_done and self.product_id.tracking == 'serial': qty_done = self.product_uom_id._compute_quantity(self.qty_done, self.product_id.uom_id) if float_compare(qty_done, 1.0, precision_rounding=self.product_id.uom_id.rounding) != 0: - message = _('You can only process 1.0 %s of products with unique serial number.') % self.product_id.uom_id.name + message = _('You can only process 1.0 %s of products with unique serial number.', self.product_id.uom_id.name) res['warning'] = {'title': _('Warning'), 'message': message} return res diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 10ce708554b..0be79095598 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -456,12 +456,12 @@ class StockQuant(models.Model): # if we want to reserve available_quantity = self._get_available_quantity(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=strict) if float_compare(quantity, available_quantity, precision_rounding=rounding) > 0: - raise UserError(_('It is not possible to reserve more products of %s than you have in stock.') % product_id.display_name) + raise UserError(_('It is not possible to reserve more products of %s than you have in stock.', product_id.display_name)) elif float_compare(quantity, 0, precision_rounding=rounding) < 0: # if we want to unreserve available_quantity = sum(quants.mapped('reserved_quantity')) if float_compare(abs(quantity), available_quantity, precision_rounding=rounding) > 0: - raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.') % product_id.display_name) + raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.', product_id.display_name)) else: return reserved_quants diff --git a/addons/stock/models/stock_rule.py b/addons/stock/models/stock_rule.py index ff49323f5af..1e7bda0be53 100644 --- a/addons/stock/models/stock_rule.py +++ b/addons/stock/models/stock_rule.py @@ -140,7 +140,7 @@ class StockRule(models.Model): if self.procure_method == 'make_to_order' and self.location_src_id: suffix = _("
A need is created in %s and a rule will be triggered to fulfill it.") % (source) if self.procure_method == 'mts_else_mto' and self.location_src_id: - suffix = _("
If the products are not available in %s, a rule will be triggered to bring products in this location.") % source + suffix = _("
If the products are not available in %s, a rule will be triggered to bring products in this location.", source) message_dict = { 'pull': _('When products are needed in %s,
%s are created from %s to fulfill the need.') % (destination, operation, source) + suffix, 'push': _('When products arrive in %s,
%s are created to send them in %s.') % (source, operation, destination) diff --git a/addons/stock/wizard/stock_picking_return.py b/addons/stock/wizard/stock_picking_return.py index a66749b81db..7bcda6b4d72 100644 --- a/addons/stock/wizard/stock_picking_return.py +++ b/addons/stock/wizard/stock_picking_return.py @@ -118,7 +118,7 @@ class ReturnPicking(models.TransientModel): 'move_lines': [], 'picking_type_id': picking_type_id, 'state': 'draft', - 'origin': _("Return of %s") % self.picking_id.name, + 'origin': _("Return of %s", self.picking_id.name), 'location_id': self.picking_id.location_dest_id.id, 'location_dest_id': self.location_id.id}) new_picking.message_post_with_view('mail.message_origin_link', diff --git a/addons/stock_account/wizard/stock_valuation_layer_revaluation.py b/addons/stock_account/wizard/stock_valuation_layer_revaluation.py index 49d693b728a..77f22d27cc8 100644 --- a/addons/stock_account/wizard/stock_valuation_layer_revaluation.py +++ b/addons/stock_account/wizard/stock_valuation_layer_revaluation.py @@ -118,7 +118,7 @@ class StockValuationLayerRevaluation(models.TransientModel): move_vals = { 'journal_id': self.account_journal_id.id or accounts['stock_journal'].id, 'company_id': self.company_id.id, - 'ref': _("Revaluation of %s") % product_id.display_name, + 'ref': _("Revaluation of %s", product_id.display_name), 'stock_valuation_layer_ids': [(6, None, [revaluation_svl.id])], 'date': self.date or fields.Date.today(), 'move_type': 'entry', diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py index 63222bc1385..076ead97c0c 100644 --- a/addons/stock_landed_costs/models/stock_landed_cost.py +++ b/addons/stock_landed_costs/models/stock_landed_cost.py @@ -204,7 +204,7 @@ class StockLandedCost(models.Model): if not lines: target_model_descriptions = dict(self._fields['target_model']._description_selection(self.env)) - raise UserError(_("You cannot apply landed costs on the chosen %s(s). Landed costs can only be applied for products with automated inventory valuation and FIFO or average costing method.") % target_model_descriptions[self.target_model]) + raise UserError(_("You cannot apply landed costs on the chosen %s(s). Landed costs can only be applied for products with automated inventory valuation and FIFO or average costing method.", target_model_descriptions[self.target_model])) return lines def compute_landed_cost(self): @@ -285,7 +285,7 @@ class StockLandedCost(models.Model): for cost in self: if not cost._get_targeted_move_ids(): target_model_descriptions = dict(self._fields['target_model']._description_selection(self.env)) - raise UserError(_('Please define %s on which those additional costs should apply.') % target_model_descriptions[cost.target_model]) + raise UserError(_('Please define %s on which those additional costs should apply.', target_model_descriptions[cost.target_model])) def _check_sum(self): """ Check if each cost line its valuation lines sum to the correct amount diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index c69ee0d66ce..383308061de 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -773,11 +773,11 @@ class ExportXlsxWriter: # fails note that you can't export cell_value = pycompat.to_text(cell_value) except UnicodeDecodeError: - raise UserError(_("Binary fields can not be exported to Excel unless their content is base64-encoded. That does not seem to be the case for %s.") % self.field_names[column]) + raise UserError(_("Binary fields can not be exported to Excel unless their content is base64-encoded. That does not seem to be the case for %s.", self.field_names)[column]) if isinstance(cell_value, str): if len(cell_value) > self.worksheet.xls_strmax: - cell_value = _("The content of this cell is too long for an XLSX file (more than %s characters). Please use the CSV format for this export.") % self.worksheet.xls_strmax + cell_value = _("The content of this cell is too long for an XLSX file (more than %s characters). Please use the CSV format for this export.", self.worksheet.xls_strmax) else: cell_value = cell_value.replace("\r", " ") elif isinstance(cell_value, datetime.datetime): diff --git a/addons/website/models/website.py b/addons/website/models/website.py index afe67a8a9ef..3e810dfa729 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -284,7 +284,7 @@ class Website(models.Model): copy_menu(submenu, new_menu) for website in self: new_top_menu = top_menu.copy({ - 'name': _('Top Menu for Website %s') % website.id, + 'name': _('Top Menu for Website %s', website.id), 'website_id': website.id, }) for submenu in top_menu.child_id: @@ -408,7 +408,7 @@ class Website(models.Model): for page in pages: dependencies.setdefault(page_key, []) dependencies[page_key].append({ - 'text': _('Page %s contains a link to this page') % page.url, + 'text': _('Page %s contains a link to this page', page.url), 'item': page.name, 'link': page.url, }) @@ -436,7 +436,7 @@ class Website(models.Model): menu_key = _('Menus') for menu in menus: dependencies.setdefault(menu_key, []).append({ - 'text': _('This page is in the menu %s') % menu.name, + 'text': _('This page is in the menu %s', menu.name), 'link': '/web#id=%s&view_type=form&model=website.menu' % menu.id, 'item': menu.name, }) @@ -472,7 +472,7 @@ class Website(models.Model): for p in pages: dependencies.setdefault(page_key, []) dependencies[page_key].append({ - 'text': _('Page %s is calling this file') % p.url, + 'text': _('Page %s is calling this file', p.url), 'item': p.name, 'link': p.url, }) diff --git a/addons/website/models/website_visitor.py b/addons/website/models/website_visitor.py index 3af252bda6e..7ff7702df94 100644 --- a/addons/website/models/website_visitor.py +++ b/addons/website/models/website_visitor.py @@ -67,7 +67,7 @@ class WebsiteVisitor(models.Model): def name_get(self): return [( record.id, - (record.name or _('Website Visitor #%s') % record.id) + (record.name or _('Website Visitor #%s', record.id)) ) for record in self] @api.depends('partner_id.email_normalized', 'partner_id.mobile', 'partner_id.phone') diff --git a/addons/website_blog/models/website.py b/addons/website_blog/models/website.py index a647326c340..fb153e3d756 100644 --- a/addons/website_blog/models/website.py +++ b/addons/website_blog/models/website.py @@ -26,7 +26,7 @@ class Website(models.Model): dep[page_key] = [] for p in posts: dep[page_key].append({ - 'text': _('Blog Post %s seems to have a link to this page !') % p.name, + 'text': _('Blog Post %s seems to have a link to this page !', p.name), 'item': p.name, 'link': p.website_url, }) @@ -51,7 +51,7 @@ class Website(models.Model): dep[page_key] = [] for p in posts: dep[page_key].append({ - 'text': _('Blog Post %s seems to be calling this file !') % p.name, + 'text': _('Blog Post %s seems to be calling this file !', p.name), 'item': p.name, 'link': p.website_url, }) diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index c99d2c0b1d0..42c07b289c7 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -215,7 +215,7 @@ class BlogPost(models.Model): @api.returns('self', lambda value: value.id) def copy_data(self, default=None): self.ensure_one() - name = _("%s (copy)") % self.name + name = _("%s (copy)", self.name) default = dict(default or {}, name=name) return super(BlogPost, self).copy_data(default) diff --git a/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py index 9f6a466ef92..9267f6300e3 100644 --- a/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py +++ b/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py @@ -69,7 +69,7 @@ class CrmLeadForwardToPartner(models.TransientModel): if no_email: raise UserError(_('Set an email address for the partner(s): %s') % ", ".join(no_email)) if self.forward_type == 'single' and not self.partner_id.email: - raise UserError(_('Set an email address for the partner %s') % self.partner_id.name) + raise UserError(_('Set an email address for the partner %s', self.partner_id.name)) partners_leads = {} for lead in self.assignation_lines: diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index f8cf3c6ea02..abe6d4c39da 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -464,7 +464,7 @@ class Post(models.Model): filter_regexp = r'()|(]*?href[^>]*?>)|(<[a-z|A-Z]+[^>]*style\s*=\s*[\'"][^\'"]*\s*background[^:]*:[^url;]*url)' content_match = re.search(filter_regexp, content, re.I) if content_match: - raise AccessError(_('%d karma required to post an image or link.') % forum.karma_editor) + raise AccessError(_('%d karma required to post an image or link.', forum.karma_editor)) return content def _default_website_meta(self): @@ -492,9 +492,9 @@ class Post(models.Model): raise UserError(_('Posting answer on a [Deleted] or [Closed] question is not possible.')) # karma-based access if not post.parent_id and not post.can_ask: - raise AccessError(_('%d karma required to create a new question.') % post.forum_id.karma_ask) + raise AccessError(_('%d karma required to create a new question.', post.forum_id.karma_ask)) elif post.parent_id and not post.can_answer: - raise AccessError(_('%d karma required to answer a question.') % post.forum_id.karma_answer) + raise AccessError(_('%d karma required to answer a question.', post.forum_id.karma_answer)) if not post.parent_id and not post.can_post: post.sudo().state = 'pending' @@ -511,7 +511,7 @@ class Post(models.Model): # Make sure only author or moderator can edit/delete messages for post in self.browse(res_ids): if not post.can_edit: - raise AccessError(_('%d karma required to edit a post.') % post.karma_edit) + raise AccessError(_('%d karma required to edit a post.', post.karma_edit)) return super(Post, self).get_mail_message_access(res_ids, operation, model_name=model_name) def write(self, vals): @@ -527,18 +527,18 @@ class Post(models.Model): if 'state' in vals: if vals['state'] in ['active', 'close']: if not post.can_close: - raise AccessError(_('%d karma required to close or reopen a post.') % post.karma_close) + raise AccessError(_('%d karma required to close or reopen a post.', post.karma_close)) trusted_keys += ['state', 'closed_uid', 'closed_date', 'closed_reason_id'] elif vals['state'] == 'flagged': if not post.can_flag: - raise AccessError(_('%d karma required to flag a post.') % post.forum_id.karma_flag) + raise AccessError(_('%d karma required to flag a post.', post.forum_id.karma_flag)) trusted_keys += ['state', 'flag_user_id'] if 'active' in vals: if not post.can_unlink: - raise AccessError(_('%d karma required to delete or reactivate a post.') % post.karma_unlink) + raise AccessError(_('%d karma required to delete or reactivate a post.', post.karma_unlink)) if 'is_correct' in vals: if not post.can_accept: - raise AccessError(_('%d karma required to accept or refuse an answer.') % post.karma_accept) + raise AccessError(_('%d karma required to accept or refuse an answer.', post.karma_accept)) # update karma except for self-acceptance mult = 1 if vals['is_correct'] else -1 if vals['is_correct'] != post.is_correct and post.create_uid.id != self._uid: @@ -546,9 +546,9 @@ class Post(models.Model): self.env.user.sudo().add_karma(post.forum_id.karma_gen_answer_accept * mult) if tag_ids: if set(post.tag_ids.ids) != tag_ids and self.env.user.karma < post.forum_id.karma_edit_retag: - raise AccessError(_('%d karma required to retag.') % post.forum_id.karma_edit_retag) + raise AccessError(_('%d karma required to retag.', post.forum_id.karma_edit_retag)) if any(key not in trusted_keys for key in vals) and not post.can_edit: - raise AccessError(_('%d karma required to edit a post.') % post.karma_edit) + raise AccessError(_('%d karma required to edit a post.', post.karma_edit)) res = super(Post, self).write(vals) @@ -575,7 +575,7 @@ class Post(models.Model): if post.state == 'active' and post.parent_id: post.parent_id.message_post_with_view( 'website_forum.forum_post_template_new_answer', - subject=_('Re: %s') % post.parent_id.name, + subject=_('Re: %s', post.parent_id.name), partner_ids=[(4, p.id) for p in tag_partners], subtype_id=self.env['ir.model.data'].xmlid_to_res_id('website_forum.mt_answer_new')) elif post.state == 'active' and not post.parent_id: @@ -647,7 +647,7 @@ class Post(models.Model): def validate(self): for post in self: if not post.can_moderate: - raise AccessError(_('%d karma required to validate a post.') % post.forum_id.karma_moderate) + raise AccessError(_('%d karma required to validate a post.', post.forum_id.karma_moderate)) # if state == pending, no karma previously added for the new question if post.state == 'pending': post.create_uid.sudo().add_karma(post.forum_id.karma_gen_question_new) @@ -662,7 +662,7 @@ class Post(models.Model): def refuse(self): for post in self: if not post.can_moderate: - raise AccessError(_('%d karma required to refuse a post.') % post.forum_id.karma_moderate) + raise AccessError(_('%d karma required to refuse a post.', post.forum_id.karma_moderate)) post.moderator_id = self.env.user return True @@ -670,7 +670,7 @@ class Post(models.Model): res = [] for post in self: if not post.can_flag: - raise AccessError(_('%d karma required to flag a post.') % post.forum_id.karma_flag) + raise AccessError(_('%d karma required to flag a post.', post.forum_id.karma_flag)) if post.state == 'flagged': res.append({'error': 'post_already_flagged'}) elif post.state == 'active': @@ -691,7 +691,7 @@ class Post(models.Model): def mark_as_offensive(self, reason_id): for post in self: if not post.can_moderate: - raise AccessError(_('%d karma required to mark a post as offensive.') % post.forum_id.karma_moderate) + raise AccessError(_('%d karma required to mark a post as offensive.', post.forum_id.karma_moderate)) # remove some karma _logger.info('Downvoting user <%s> for posting spam/offensive contents', post.create_uid) post.create_uid.sudo().add_karma(post.forum_id.karma_gen_answer_flagged) @@ -721,7 +721,7 @@ class Post(models.Model): def unlink(self): for post in self: if not post.can_unlink: - raise AccessError(_('%d karma required to unlink a post.') % post.karma_unlink) + raise AccessError(_('%d karma required to unlink a post.', post.karma_unlink)) # if unlinking an answer with accepted answer: remove provided karma for post in self: if post.is_correct: @@ -766,7 +766,7 @@ class Post(models.Model): # karma-based action check: use the post field that computed own/all value if not self.can_comment_convert: - raise AccessError(_('%d karma required to convert an answer to a comment.') % self.karma_comment_convert) + raise AccessError(_('%d karma required to convert an answer to a comment.', self.karma_comment_convert)) # post the message question = self.parent_id @@ -806,9 +806,9 @@ class Post(models.Model): can_convert = self.env.user.karma >= karma_convert if not can_convert: if is_author and karma_own < karma_all: - raise AccessError(_('%d karma required to convert your comment to an answer.') % karma_own) + raise AccessError(_('%d karma required to convert your comment to an answer.', karma_own)) else: - raise AccessError(_('%d karma required to convert a comment to an answer.') % karma_all) + raise AccessError(_('%d karma required to convert a comment to an answer.', karma_all)) # check the message's author has not already an answer question = post.parent_id if post.parent_id else post @@ -846,7 +846,7 @@ class Post(models.Model): ) can_unlink = user.karma >= karma_unlink if not can_unlink: - raise AccessError(_('%d karma required to unlink a comment.') % karma_unlink) + raise AccessError(_('%d karma required to unlink a comment.', karma_unlink)) result.append(comment.unlink()) return result @@ -893,7 +893,7 @@ class Post(models.Model): self.ensure_one() if not self.can_comment: - raise AccessError(_('%d karma required to comment.') % self.karma_comment) + raise AccessError(_('%d karma required to comment.', self.karma_comment)) if not kwargs.get('record_name') and self.parent_id: kwargs['record_name'] = self.parent_id.name return super(Post, self).message_post(message_type=message_type, **kwargs) @@ -1005,9 +1005,9 @@ class Vote(models.Model): def _check_karma_rights(self, upvote=None): # karma check if upvote and not self.post_id.can_upvote: - raise AccessError(_('%d karma required to upvote.') % self.post_id.forum_id.karma_upvote) + raise AccessError(_('%d karma required to upvote.', self.post_id.forum_id.karma_upvote)) elif not upvote and not self.post_id.can_downvote: - raise AccessError(_('%d karma required to downvote.') % self.post_id.forum_id.karma_downvote) + raise AccessError(_('%d karma required to downvote.', self.post_id.forum_id.karma_downvote)) def _vote_update_karma(self, old_vote, new_vote): if self.post_id.parent_id: @@ -1042,5 +1042,5 @@ class Tags(models.Model): def create(self, vals): forum = self.env['forum.forum'].browse(vals.get('forum_id')) if self.env.user.karma < forum.karma_tag_create: - raise AccessError(_('%d karma required to create a new Tag.') % forum.karma_tag_create) + raise AccessError(_('%d karma required to create a new Tag.', forum.karma_tag_create)) return super(Tags, self.with_context(mail_create_nolog=True, mail_create_nosubscribe=True)).create(vals) diff --git a/addons/website_livechat/models/mail_channel.py b/addons/website_livechat/models/mail_channel.py index 804571bde42..86ab7aeb2c3 100644 --- a/addons/website_livechat/models/mail_channel.py +++ b/addons/website_livechat/models/mail_channel.py @@ -58,7 +58,7 @@ class MailChannel(models.Model): message = _("""%s has started a conversation with %s. The chat request has been canceled.""") % (name, operator or _('an operator')) else: - message = _('%s has left the conversation.') % name + message = _('%s has left the conversation.', name) return message diff --git a/addons/website_sale/models/product_image.py b/addons/website_sale/models/product_image.py index 5fe484a6a5c..eea9afb6967 100644 --- a/addons/website_sale/models/product_image.py +++ b/addons/website_sale/models/product_image.py @@ -40,7 +40,7 @@ class ProductImage(models.Model): def _check_valid_video_url(self): for image in self: if image.video_url and not image.embed_code: - raise ValidationError(_("Provided video URL for '%s' is not valid. Please enter a valid video URL.") % image.name) + raise ValidationError(_("Provided video URL for '%s' is not valid. Please enter a valid video URL.", image.name)) @api.model_create_multi def create(self, vals_list): diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 73e52810c61..c71a6201f9f 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -361,9 +361,9 @@ class SaleOrderLine(models.Model): def get_sale_order_line_multiline_description_sale(self, product): description = super(SaleOrderLine, self).get_sale_order_line_multiline_description_sale(product) if self.linked_line_id: - description += "\n" + _("Option for: %s") % self.linked_line_id.product_id.display_name + description += "\n" + _("Option for: %s", self.linked_line_id.product_id.display_name) if self.option_line_ids: - description += "\n" + '\n'.join([_("Option: %s") % option_line.product_id.display_name for option_line in self.option_line_ids]) + description += "\n" + '\n'.join([_("Option: %s", option_line.product_id.display_name) for option_line in self.option_line_ids]) return description @api.depends('product_id.display_name') diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 1e896d3f754..68648b7ff9d 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -993,7 +993,7 @@ class WebsiteSlides(WebsiteProfile): return preview existing_slide = Slide.search([('channel_id', '=', int(data['channel_id'])), ('document_id', '=', document_id)], limit=1) if existing_slide: - preview['error'] = _('This video already exists in this channel on the following slide: %s') % existing_slide.name + preview['error'] = _('This video already exists in this channel on the following slide: %s', existing_slide.name) return preview values = Slide._parse_document_url(data['url'], only_preview_fields=True) if values.get('error'): @@ -1051,7 +1051,7 @@ class WebsiteSlides(WebsiteProfile): return {'error': e.args[0]} except Exception as e: _logger.error(e) - return {'error': _('Internal server error, please try again later or contact administrator.\nHere is the error message: %s') % e} + return {'error': _('Internal server error, please try again later or contact administrator.\nHere is the error message: %s', e)} # ensure correct ordering by re sequencing slides in front-end (backend should be ok thanks to list view) channel._resequence_slides(slide, force_category=category) diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index 36ba1c351f7..401878ee94b 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -446,7 +446,7 @@ class Channel(models.Model): action = self.env.ref('website_slides.slide_channel_partner_action').read()[0] action['domain'] = [('channel_id', 'in', self.ids)] if len(self) == 1: - action['display_name'] = _('Attendees of %s') % self.name + action['display_name'] = _('Attendees of %s', self.name) action['context'] = {'active_test': False, 'default_channel_id': self.id} if state: action['domain'] += [('completed', '=', state == 'completed')] diff --git a/addons/website_slides/models/slide_question.py b/addons/website_slides/models/slide_question.py index 96dc76c8c63..2ebe650043a 100644 --- a/addons/website_slides/models/slide_question.py +++ b/addons/website_slides/models/slide_question.py @@ -24,9 +24,9 @@ class SlideQuestion(models.Model): def _check_answers_integrity(self): for question in self: if len(question.answer_ids.filtered(lambda answer: answer.is_correct)) != 1: - raise ValidationError(_('Question "%s" must have 1 correct answer') % question.question) + raise ValidationError(_('Question "%s" must have 1 correct answer', question.question)) if len(question.answer_ids) < 2: - raise ValidationError(_('Question "%s" must have 1 correct answer and at least 1 invalid answer') % question.question) + raise ValidationError(_('Question "%s" must have 1 correct answer and at least 1 invalid answer', question.question)) @api.depends('slide_id') def _compute_statistics(self): diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index 6e600f90b44..45bf3a722be 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -795,7 +795,7 @@ class Slide(models.Model): if error == 'keyInvalid': return _('Your Google API key is invalid, please update it into your settings.\nSettings > Website > Features > API Key') - return _('Could not fetch data from url. Document or access right not available:\n%s') % error + return _('Could not fetch data from url. Document or access right not available:\n%s', error) @api.model def _parse_google_document(self, document_id, only_preview_fields): diff --git a/odoo/addons/base/models/ir_actions.py b/odoo/addons/base/models/ir_actions.py index fb0fa446b5d..478d2723679 100644 --- a/odoo/addons/base/models/ir_actions.py +++ b/odoo/addons/base/models/ir_actions.py @@ -147,9 +147,9 @@ class IrActionsActWindow(models.Model): def _check_model(self): for action in self: if action.res_model not in self.env: - raise ValidationError(_('Invalid model name %r in action definition.') % action.res_model) + raise ValidationError(_('Invalid model name %r in action definition.', action.res_model)) if action.binding_model_id and action.binding_model_id.model not in self.env: - raise ValidationError(_('Invalid model name %r in action definition.') % action.binding_model_id.model) + raise ValidationError(_('Invalid model name %r in action definition.', action.binding_model_id.model)) @api.depends('view_ids.view_mode', 'view_mode', 'view_id.type') def _compute_views(self): @@ -178,9 +178,9 @@ class IrActionsActWindow(models.Model): for rec in self: modes = rec.view_mode.split(',') if len(modes) != len(set(modes)): - raise ValidationError(_('The modes in view_mode must not be duplicated: %s') % modes) + raise ValidationError(_('The modes in view_mode must not be duplicated: %s', modes)) if ' ' in modes: - raise ValidationError(_('No spaces allowed in view_mode: %r') % modes) + raise ValidationError(_('No spaces allowed in view_mode: %r', modes)) @api.depends('res_model', 'search_view_id') def _compute_search_view(self): diff --git a/odoo/addons/base/models/ir_fields.py b/odoo/addons/base/models/ir_fields.py index dd8375902ea..116e4c9aaa6 100644 --- a/odoo/addons/base/models/ir_fields.py +++ b/odoo/addons/base/models/ir_fields.py @@ -207,7 +207,7 @@ class IrFieldsConverter(models.AbstractModel): ValueError, _(u"'%s' does not seem to be a valid date for field '%%(field)s'"), value, - {'moreinfo': _(u"Use the format '%s'") % u"2012-12-31"} + {'moreinfo': _(u"Use the format '%s'", u"2012-12-31")} ) @api.model @@ -239,7 +239,7 @@ class IrFieldsConverter(models.AbstractModel): ValueError, _(u"'%s' does not seem to be a valid datetime for field '%%(field)s'"), value, - {'moreinfo': _(u"Use the format '%s'") % u"2012-12-31 23:59:59"} + {'moreinfo': _(u"Use the format '%s'", u"2012-12-31 23:59:59")} ) input_tz = self._input_tz()# Apply input tz to the parsed naive datetime @@ -363,7 +363,7 @@ class IrFieldsConverter(models.AbstractModel): try: id, _name = RelatedModel.name_create(name=value) except (Exception, psycopg2.IntegrityError): - error_msg = _(u"Cannot create new '%s' records from their name alone. Please create those records manually and try importing again.") % RelatedModel._description + error_msg = _(u"Cannot create new '%s' records from their name alone. Please create those records manually and try importing again.", RelatedModel._description) else: raise self._format_import_error( Exception, diff --git a/odoo/addons/base/models/ir_filters.py b/odoo/addons/base/models/ir_filters.py index 5e080bf8b4a..0c948d6c0f2 100644 --- a/odoo/addons/base/models/ir_filters.py +++ b/odoo/addons/base/models/ir_filters.py @@ -35,7 +35,7 @@ class IrFilters(models.Model): def copy(self, default=None): self.ensure_one() - default = dict(default or {}, name=_('%s (copy)') % self.name) + default = dict(default or {}, name=_('%s (copy)', self.name)) return super(IrFilters, self).copy(default) def _get_eval_domain(self): diff --git a/odoo/addons/base/models/ir_mail_server.py b/odoo/addons/base/models/ir_mail_server.py index af83fee5805..9c72e54fdbb 100644 --- a/odoo/addons/base/models/ir_mail_server.py +++ b/odoo/addons/base/models/ir_mail_server.py @@ -115,7 +115,7 @@ class IrMailServer(models.Model): # let UserErrors (messages) bubble up raise e except Exception as e: - raise UserError(_("Connection Test Failed! Here is what we got instead:\n %s") % ustr(e)) + raise UserError(_("Connection Test Failed! Here is what we got instead:\n %s", ustr(e))) finally: try: if smtp: @@ -437,7 +437,7 @@ class IrMailServer(models.Model): raise except Exception as e: params = (ustr(smtp_server), e.__class__.__name__, ustr(e)) - msg = _("Mail delivery failed via SMTP server '%s'.\n%s: %s") % params + msg = _("Mail delivery failed via SMTP server '%s'.\n%s: %s", *params) _logger.info(msg) raise MailDeliveryException(_("Mail Delivery Failed"), msg) return message_id diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py index 3cac7511402..37acf600cae 100644 --- a/odoo/addons/base/models/ir_model.py +++ b/odoo/addons/base/models/ir_model.py @@ -230,7 +230,7 @@ class IrModel(models.Model): order_fields = RE_ORDER_FIELDS.findall(model.order) for field in order_fields: if field not in stored_fields: - raise ValidationError(_("Unable to order by %s: fields used for ordering must be present on the model and stored.") % field) + raise ValidationError(_("Unable to order by %s: fields used for ordering must be present on the model and stored.", field)) _sql_constraints = [ ('obj_name_uniq', 'unique (model)', 'Each model must be unique!'), @@ -286,7 +286,7 @@ class IrModel(models.Model): if not self._context.get(MODULE_UNINSTALL_FLAG): for model in self: if model.state != 'manual': - raise UserError(_("Model '%s' contains module data and cannot be removed.") % model.name) + raise UserError(_("Model '%s' contains module data and cannot be removed.", model.name)) # prevent screwing up fields that depend on these models' fields model.field_id._prepare_update() @@ -649,7 +649,7 @@ class IrModelFields(models.Model): if self.relation not in self.env: return { 'warning': { - 'title': _('Model %s does not exist') % self.relation, + 'title': _('Model %s does not exist', self.relation), 'message': _('Please specify a valid model for the object relation'), } } @@ -676,7 +676,7 @@ class IrModelFields(models.Model): return return {'warning': { 'title': _("Warning"), - 'message': _("The table %r if used for other, possibly incompatible fields.") % self.relation_table, + 'message': _("The table %r if used for other, possibly incompatible fields.", self.relation_table), }} @api.onchange('required', 'ttype', 'on_delete') @@ -791,7 +791,7 @@ class IrModelFields(models.Model): raise UserError("\n".join([ _("Cannot rename/delete fields that are still present in views:"), _("Fields: %s") % ", ".join(str(f) for f in fields), - _("View: %s") % view.name, + _("View: %s", view.name), ])) else: # uninstall mode @@ -866,7 +866,7 @@ class IrModelFields(models.Model): if vals.get('state', 'manual') == 'manual': if vals.get('relation') and not self.env['ir.model'].search([('model', '=', vals['relation'])]): - raise UserError(_("Model %s does not exist!") % vals['relation']) + raise UserError(_("Model %s does not exist!", vals['relation'])) if vals.get('ttype') == 'one2many': if not self.search([('model_id', '=', vals['relation']), ('name', '=', vals['relation_field']), ('ttype', '=', 'many2one')]): diff --git a/odoo/addons/base/models/ir_module.py b/odoo/addons/base/models/ir_module.py index 4d6b22cc42c..fbc68d33a82 100644 --- a/odoo/addons/base/models/ir_module.py +++ b/odoo/addons/base/models/ir_module.py @@ -799,7 +799,7 @@ class Module(models.Model): content = response.content except Exception: _logger.exception('Failed to fetch module %s', module_name) - raise UserError(_('The `%s` module appears to be unavailable at the moment, please try again later.') % module_name) + raise UserError(_('The `%s` module appears to be unavailable at the moment, please try again later.', module_name)) else: zipfile.ZipFile(io.BytesIO(content)).extractall(tmp) assert os.path.isdir(os.path.join(tmp, module_name)) diff --git a/odoo/addons/base/models/ir_translation.py b/odoo/addons/base/models/ir_translation.py index 590c9fd64f3..47054542a82 100644 --- a/odoo/addons/base/models/ir_translation.py +++ b/odoo/addons/base/models/ir_translation.py @@ -547,7 +547,7 @@ class IrTranslation(models.Model): continue value2 = field.translate({val: src}.get, value1) if value2 != value0: - raise ValidationError(_("Translation is not valid:\n%s") % val) + raise ValidationError(_("Translation is not valid:\n%s", val)) @api.model_create_multi def create(self, vals_list): diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py index c5b3749ffee..8d9925258c7 100644 --- a/odoo/addons/base/models/ir_ui_view.py +++ b/odoo/addons/base/models/ir_ui_view.py @@ -402,7 +402,7 @@ actual arch. if check == "Warning": _logger.warning(_('Invalid view %s definition in %s \n%s'), view_name, view.arch_fs, view.arch) except ValueError as e: - raise ValidationError(_("Error while validating view:\n\n%s") % tools.ustr(e)).with_traceback(e.__traceback__) from None + raise ValidationError(_("Error while validating view:\n\n%s", tools.ustr(e))).with_traceback(e.__traceback__) from None return True @@ -622,7 +622,7 @@ actual arch. error = _("View '%s' accessible only to groups %s ") % \ (self.key, ", ".join([g.name for g in self.groups_id])) else: - error = _("View '%s' is private") % self.key + error = _("View '%s' is private", self.key) raise AccessError(error) def handle_view_error(self, message, *, raise_exception=True, from_exception=None, from_traceback=None): @@ -1085,7 +1085,7 @@ actual arch. type_ = node.get('type') if special: if special not in ('cancel', 'save', 'add'): - self.handle_view_error(_("Invalid special '%s' in button") % special) + self.handle_view_error(_("Invalid special '%s' in button", special)) elif type_: if type_ == 'edit': # list_renderer, used in kanban view return @@ -1291,7 +1291,7 @@ actual arch. # further improvement: add all groups to name_manager in # order to batch check them at the end if not self.env['ir.model.data'].xmlid_to_res_id(group.strip(), raise_if_not_found=False): - msg = _("The group %r defined in view does not exist!") % group + msg = _("The group %r defined in view does not exist!", group) self.handle_view_error(msg, raise_exception=False) elif attr == 'group': @@ -1887,7 +1887,7 @@ class NameManager: for field_name in self.available_fields: if field_name not in self.fields_get: - message = _("Field `%s` does not exist") % field_name + message = _("Field `%s` does not exist", field_name) view.handle_view_error(message) for field, use in self.mandatory_fields.items(): diff --git a/odoo/addons/base/models/res_config.py b/odoo/addons/base/models/res_config.py index 1cba371e188..76737ee03aa 100644 --- a/odoo/addons/base/models/res_config.py +++ b/odoo/addons/base/models/res_config.py @@ -425,7 +425,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) return { 'warning': { 'title': _('Warning!'), - 'message': _('Disabling this option will also uninstall the following modules \n%s') % message, + 'message': _('Disabling this option will also uninstall the following modules \n%s', message), } } return {} @@ -549,7 +549,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) # The other methods that start with `get_default_` are deprecated for method in dir(self): if method.startswith('get_default_'): - _logger.warning(_('Methods that start with `get_default_` are deprecated. Override `get_values` instead(Method %s)') % method) + _logger.warning(_('Methods that start with `get_default_` are deprecated. Override `get_values` instead(Method %s)', method)) res.update(self.get_values()) return res @@ -607,7 +607,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) # Methods that start with `set_` are now deprecated for method in dir(self): if method.startswith('set_') and method != 'set_values': - _logger.warning(_('Methods that start with `set_` are deprecated. Override `set_values` instead (Method %s)') % method) + _logger.warning(_('Methods that start with `set_` are deprecated. Override `set_values` instead (Method %s)', method)) def execute(self): self.ensure_one() diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index 6d3e86839b7..6e76e9b0295 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -318,7 +318,7 @@ class Partner(models.Model): def copy(self, default=None): self.ensure_one() chosen_name = default.get('name') if default else '' - new_name = chosen_name or _('%s (copy)') % self.name + new_name = chosen_name or _('%s (copy)', self.name) default = dict(default or {}, name=new_name) return super(Partner, self).copy(default) diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index f0941d134fb..d8d00b125c3 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -166,7 +166,7 @@ class Groups(models.Model): def copy(self, default=None): self.ensure_one() chosen_name = default.get('name') if default else '' - default_name = chosen_name or _('%s (copy)') % self.name + default_name = chosen_name or _('%s (copy)', self.name) default = dict(default or {}, name=default_name) return super(Groups, self).copy(default) @@ -585,9 +585,9 @@ class Users(models.Model): self.ensure_one() default = dict(default or {}) if ('name' not in default) and ('partner_id' not in default): - default['name'] = _("%s (copy)") % self.name + default['name'] = _("%s (copy)", self.name) if 'login' not in default: - default['login'] = _("%s (copy)") % self.login + default['login'] = _("%s (copy)", self.login) return super(Users, self).copy(default) @api.model diff --git a/odoo/addons/base/wizard/base_update_translations.py b/odoo/addons/base/wizard/base_update_translations.py index c05d85b7517..0ac9b301d7b 100644 --- a/odoo/addons/base/wizard/base_update_translations.py +++ b/odoo/addons/base/wizard/base_update_translations.py @@ -22,7 +22,7 @@ class BaseUpdateTranslations(models.TransientModel): def _get_lang_name(self, lang_code): lang = self.env['res.lang']._lang_get(lang_code) if not lang: - raise UserError(_('No language with code "%s" exists') % lang_code) + raise UserError(_('No language with code "%s" exists', lang_code)) return lang.name def act_update(self): diff --git a/odoo/models.py b/odoo/models.py index 397d13f2691..1ab766d9b07 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -991,7 +991,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): # broken transaction, exit and hope the source error was already logged if not any(message['type'] == 'error' for message in messages): info = data_list[0]['info'] - messages.append(dict(info, type='error', message=_(u"Unknown database error: '%s'") % e)) + messages.append(dict(info, type='error', message=_(u"Unknown database error: '%s'", e))) return except Exception: pass @@ -1188,7 +1188,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): type='error', record=stream.index, field='.id', - message=_(u"Unknown database identifier '%s'") % dbid)) + message=_(u"Unknown database identifier '%s'", dbid))) dbid = False converted = convert(record, functools.partial(_log, extras, stream.index)) @@ -1442,7 +1442,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): self._fields, 'date_stop'): if not set_first_of(["date_delay", "planned_hours", "x_date_delay", "x_planned_hours"], self._fields, 'date_delay'): - raise UserError(_("Insufficient fields to generate a Calendar View for %s, missing a date_stop or a date_delay") % self._name) + raise UserError(_("Insufficient fields to generate a Calendar View for %s, missing a date_stop or a date_delay", self._name)) return view @@ -1521,7 +1521,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): result['type'] = view_type result['name'] = 'default' except AttributeError: - raise UserError(_("No default view of type '%s' could be found !") % view_type) + raise UserError(_("No default view of type '%s' could be found !", view_type)) return result @api.model @@ -2221,7 +2221,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): match = regex_field_agg.match(fspec) if not match: - raise UserError(_("Invalid field specification %r.") % fspec) + raise UserError(_("Invalid field specification %r.", fspec)) name, func, fname = match.groups() if func: @@ -2231,9 +2231,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): if not field: raise ValueError("Invalid field %r on model %r" % (fname, self._name)) if not (field.base_field.store and field.base_field.column_type): - raise UserError(_("Cannot aggregate field %r.") % fname) + raise UserError(_("Cannot aggregate field %r.", fname)) if func not in VALID_AGGREGATE_FUNCTIONS: - raise UserError(_("Invalid aggregation function %r.") % func) + raise UserError(_("Invalid aggregation function %r.", func)) else: # we have 'name', retrieve the aggregator on the field field = self._fields.get(name) @@ -2249,7 +2249,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): if fname in groupby_fields: continue if name in aggregated_fields: - raise UserError(_("Output name %r is used twice.") % name) + raise UserError(_("Output name %r is used twice.", name)) aggregated_fields.append(name) expr = self._inherits_join_calc(self._table, fname, query) @@ -3657,7 +3657,7 @@ Record ids: %(records)s cr.execute(query, params + [sub_ids]) 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 + _('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) ) diff --git a/odoo/service/model.py b/odoo/service/model.py index 6cc05476195..3165c6c0ead 100644 --- a/odoo/service/model.py +++ b/odoo/service/model.py @@ -155,7 +155,7 @@ def execute_cr(cr, uid, obj, method, *args, **kw): odoo.api.Environment.reset() # clean cache etc if we retry the same transaction recs = odoo.api.Environment(cr, uid, {}).get(obj) if recs is None: - raise UserError(_("Object %s doesn't exist") % obj) + raise UserError(_("Object %s doesn't exist", obj)) result = odoo.api.call_kw(recs, method, args, kw) # force evaluation of lazy values before the cursor is closed, as it would # error afterwards if the lazy isn't already evaluated (and cached) diff --git a/odoo/tools/image.py b/odoo/tools/image.py index 590bdf1bbfa..3cde458e2db 100644 --- a/odoo/tools/image.py +++ b/odoo/tools/image.py @@ -86,7 +86,7 @@ class ImageProcess(): w, h = self.image.size if verify_resolution and w * h > IMAGE_MAX_RESOLUTION: - raise ValueError(_("Image size excessive, uploaded images must be smaller than %s million pixels.") % str(IMAGE_MAX_RESOLUTION / 10e6)) + raise ValueError(_("Image size excessive, uploaded images must be smaller than %s million pixels.", str(IMAGE_MAX_RESOLUTION / 10e6))) def image_base64(self, quality=0, output_format=''): """Return the base64 encoded image resulting of all the image processing diff --git a/odoo/tools/template_inheritance.py b/odoo/tools/template_inheritance.py index 33cedf7c12d..20a7d2aeee7 100644 --- a/odoo/tools/template_inheritance.py +++ b/odoo/tools/template_inheritance.py @@ -231,7 +231,7 @@ def apply_inheritance_specs(source, specs_tree, inherit_branding=False, pre_loca ]) tag = "<%s%s>" % (spec.tag, attrs) raise ValueError( - _("Element '%s' cannot be located in parent view") % tag + _("Element '%s' cannot be located in parent view", tag) ) return source diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 745f2cd8cb0..e98ad4e9b7a 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -555,7 +555,7 @@ def TranslationFileReader(source, fileformat='po'): if fileformat == 'po': return PoFileReader(source) _logger.info('Bad file format: %s', fileformat) - raise Exception(_('Bad file format: %s') % fileformat) + raise Exception(_('Bad file format: %s', fileformat)) class CSVFileReader: def __init__(self, source):