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 = _("