From df36b6ed3f9f55663404bea709aad645a766ab34 Mon Sep 17 00:00:00 2001 From: Mmequignon Date: Thu, 19 Dec 2024 16:32:08 +0100 Subject: [PATCH] report_xlsx: Fix currency format --- report_xlsx/report/report_abstract_xlsx.py | 6 ++---- report_xlsx/tests/test_report.py | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/report_xlsx/report/report_abstract_xlsx.py b/report_xlsx/report/report_abstract_xlsx.py index 1abbdf7273..5ea3bb923b 100644 --- a/report_xlsx/report/report_abstract_xlsx.py +++ b/report_xlsx/report/report_abstract_xlsx.py @@ -92,11 +92,9 @@ def _get_objs_for_report(self, docids, data): return self.env[self.env.context.get("active_model")].browse(ids) def _report_xlsx_currency_format(self, currency): - """Get the format to be used in cells (symbol included). + """Get currency format to be used in cells. Used in account_financial_report addon""" - s_before = currency.symbol if currency.position == "before" else "" - s_after = " %s" % currency.symbol if currency.position == "after" else "" - return f"{f'{s_before}'}#,##0.{'0' * currency.decimal_places}{f'{s_after}'}" + return f"#,##0.{'0' * currency.decimal_places}" def create_xlsx_report(self, docids, data): objs = self._get_objs_for_report(docids, data) diff --git a/report_xlsx/tests/test_report.py b/report_xlsx/tests/test_report.py index a254294b1b..603d891449 100644 --- a/report_xlsx/tests/test_report.py +++ b/report_xlsx/tests/test_report.py @@ -59,9 +59,5 @@ def test_id_retrieval(self): def test_currency_format(self): usd = self.env.ref("base.USD") self.assertEqual( - self.xlsx_report._report_xlsx_currency_format(usd), "$#,##0.00" - ) - eur = self.env.ref("base.EUR") - self.assertEqual( - self.xlsx_report._report_xlsx_currency_format(eur), "#,##0.00 €" + self.xlsx_report._report_xlsx_currency_format(usd), "#,##0.00" )