From 31c7a2ff90728baa7c1c2e16a1a88fd1535bd77e Mon Sep 17 00:00:00 2001 From: AH-Yussef Date: Wed, 29 Nov 2023 10:32:42 +0000 Subject: [PATCH] [FIX] account: format transfer source containing % Steps to reproduce: - Install Accounting app - Go to the Accounting app - Go to Configuration > Chart of Accounts and create a New account with a name containing % - Go to Accounting > Journal Items - Select a Jounral item and from Actions, choose move to Account - In the popup displayed, choose the new account created ealier in the To field, and choose a Journal - Click `Create Journal Entries`, an error arises Invistigation: When the `account_target_name` contains a % literal (ex. "test %"), the `transfer_format` beccomes `"{amount} ({debit_credit}) from %s were transferred to test % by {link}"` https://github.com/odoo/odoo/blob/a56586119845969e9d867a220f5330a6c7daa5c2/addons/account/wizard/account_automatic_entry_wizard.py#L429- - You can notice that now the string has two % placeholders that need two be substituted, but only argument is provided which is `account.display_name` and so we get a the error `TypeError: not enough arguments for format string` https://github.com/odoo/odoo/blob/a56586119845969e9d867a220f5330a6c7daa5c2/addons/account/wizard/account_automatic_entry_wizard.py#L433 opw-3601886 closes odoo/odoo#145762 X-original-commit: 1582a0ae28fec12175845dcfdebbb8d6b4bcde33 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: Ali Hassan Youssef (alhy) --- addons/account/wizard/account_automatic_entry_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_automatic_entry_wizard.py b/addons/account/wizard/account_automatic_entry_wizard.py index 8ae77b748cb..ada602f580f 100644 --- a/addons/account/wizard/account_automatic_entry_wizard.py +++ b/addons/account/wizard/account_automatic_entry_wizard.py @@ -477,7 +477,7 @@ class AutomaticEntryWizard(models.TransientModel): return Markup("
    %s
") % Markup().join([ Markup("
  • %s
  • ") % \ - self._format_strings(transfer_format, transfer_move, balance) % (Markup("%s") % account.display_name) + self._format_strings(transfer_format % (Markup("%s") % account.display_name), transfer_move, balance) for account, balance in balances_per_account.items() if account != self.destination_account_id ])