From 8cb110a28a736d0b62601450694c3acb21309b86 Mon Sep 17 00:00:00 2001 From: Saran440 Date: Fri, 7 Jun 2024 12:02:05 +0700 Subject: [PATCH] [FIX] pre-commit --- budget_control/models/budget_control.py | 18 +++++++++++------- budget_control/models/budget_period.py | 8 ++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/budget_control/models/budget_control.py b/budget_control/models/budget_control.py index afc164a0..b0162139 100644 --- a/budget_control/models/budget_control.py +++ b/budget_control/models/budget_control.py @@ -241,9 +241,10 @@ def _check_budget_control_over_consumed(self): ) if budget_info["amount_balance"] < 0: raise UserError( - _("Total amount in KPI {} will result in {:,.2f}").format( - line.name, budget_info["amount_balance"] - ) + _( + "Total amount in KPI %(name)s will result in {:,.2f}", + name=line.name, + ).format(budget_info["amount_balance"]) ) @api.onchange("use_all_kpis") @@ -365,8 +366,10 @@ def _check_budget_amount(self): ): raise UserError( _( - "Planning amount should equal to the released amount {:,.2f} {}" - ).format(rec.released_amount, rec.currency_id.symbol) + "Planning amount should equal " + "to the released amount {:,.2f} %(symbol)s", + symbol=rec.currency_id.symbol, + ).format(rec.released_amount) ) # Check plan vs intial if ( @@ -380,8 +383,9 @@ def _check_budget_amount(self): raise UserError( _( "Planning amount should be greater than " - "initial balance {:,.2f} {}" - ).format(rec.amount_initial, rec.currency_id.symbol) + "initial balance {:,.2f} %(symbol)s", + symbol=rec.currency_id.symbol, + ).format(rec.amount_initial) ) def action_draft(self): diff --git a/budget_control/models/budget_period.py b/budget_control/models/budget_period.py index 2c721ebf..e9864e35 100644 --- a/budget_control/models/budget_period.py +++ b/budget_control/models/budget_period.py @@ -438,7 +438,7 @@ def _check_budget_available(self, controls, budget_period): balance_currency = self._get_balance_currency( company, balance, doc_currency, date_commit ) - fomatted_balance = format_amount( + formatted_balance = format_amount( self.env, balance_currency, doc_currency ) analytic_name = Analytic.browse(analytic_id).display_name @@ -447,7 +447,11 @@ def _check_budget_available(self, controls, budget_period): template_lines.display_name, analytic_name ) warnings.append( - _("{0}, will result in {1}").format(analytic_name, fomatted_balance) + _( + "%(analytic_name)s, will result in %(formatted_balance)s", + analytic_name=analytic_name, + formatted_balance=formatted_balance, + ) ) return list(set(warnings))