diff --git a/addons/account_check_printing/tests/test_print_check.py b/addons/account_check_printing/tests/test_print_check.py index c3b343e2485..e82a14930f9 100644 --- a/addons/account_check_printing/tests/test_print_check.py +++ b/addons/account_check_printing/tests/test_print_check.py @@ -2,6 +2,7 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo.addons.account_check_printing.models.account_payment import INV_LINES_PER_STUB from odoo.tests import tagged +from odoo.tools.misc import NON_BREAKING_SPACE import math @@ -124,8 +125,8 @@ class TestPrintCheck(AccountTestInvoicingCommon): self.assertEqual(stub_pages, [[{ 'due_date': '01/01/2016', 'number': invoice.name, - 'amount_total': '$ 100.00', - 'amount_residual': '$ 50.00', - 'amount_paid': '150.000 ☺', + 'amount_total': f'${NON_BREAKING_SPACE}100.00', + 'amount_residual': f'${NON_BREAKING_SPACE}50.00', + 'amount_paid': f'150.000{NON_BREAKING_SPACE}☺', 'currency': invoice.currency_id, }]]) diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py index 7d7bb1fea5b..93dab1664cf 100644 --- a/odoo/tools/misc.py +++ b/odoo/tools/misc.py @@ -59,6 +59,8 @@ SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.Com # Configure default global parser etree.set_default_parser(etree.XMLParser(resolve_entities=False)) +NON_BREAKING_SPACE = u'\N{NO-BREAK SPACE}' + #---------------------------------------------------------- # Subprocesses #---------------------------------------------------------- @@ -1316,9 +1318,9 @@ def formatLang(env, value, digits=None, grouping=True, monetary=False, dp=False, if currency_obj and currency_obj.symbol: if currency_obj.position == 'after': - res = '%s %s' % (res, currency_obj.symbol) + res = '%s%s%s' % (res, NON_BREAKING_SPACE, currency_obj.symbol) elif currency_obj and currency_obj.position == 'before': - res = '%s %s' % (currency_obj.symbol, res) + res = '%s%s%s' % (currency_obj.symbol, NON_BREAKING_SPACE, res) return res