[FIX] report,qweb: use non-beaking space between amount and currency
Fixes #6369 opw-633975
This commit is contained in:
parent
90cb409be9
commit
7feb9c112b
|
@ -845,9 +845,9 @@ class MonetaryConverter(osv.AbstractModel):
|
|||
|
||||
pre = post = u''
|
||||
if display_currency.position == 'before':
|
||||
pre = u'{symbol} '
|
||||
pre = u'{symbol}\N{NO-BREAK SPACE}'
|
||||
else:
|
||||
post = u' {symbol}'
|
||||
post = u'\N{NO-BREAK SPACE}{symbol}'
|
||||
|
||||
return HTMLSafe(u'{pre}<span class="oe_currency_value">{0}</span>{post}'.format(
|
||||
formatted_amount,
|
||||
|
@ -1006,9 +1006,9 @@ class QwebWidgetMonetary(osv.AbstractModel):
|
|||
)
|
||||
pre = post = u''
|
||||
if display.position == 'before':
|
||||
pre = u'{symbol} '
|
||||
pre = u'{symbol}\N{NO-BREAK SPACE}'
|
||||
else:
|
||||
post = u' {symbol}'
|
||||
post = u'\N{NO-BREAK SPACE}{symbol}'
|
||||
|
||||
return u'{pre}{0}{post}'.format(
|
||||
formatted_amount, pre=pre, post=post
|
||||
|
|
|
@ -130,10 +130,10 @@ class TestCurrencyExport(TestExport):
|
|||
'data-oe-field="value" data-oe-type="monetary" '
|
||||
'data-oe-expression="obj.value">'
|
||||
'<span class="oe_currency_value">0.12</span>'
|
||||
' {symbol}</span>'.format(
|
||||
u'\N{NO-BREAK SPACE}{symbol}</span>'.format(
|
||||
obj=obj,
|
||||
symbol=currency.symbol.encode('utf-8')
|
||||
),)
|
||||
).encode('utf-8'),)
|
||||
|
||||
def test_currency_pre(self):
|
||||
currency = self.create(
|
||||
|
@ -147,12 +147,12 @@ class TestCurrencyExport(TestExport):
|
|||
'<span data-oe-model="{obj._model._name}" data-oe-id="{obj.id}" '
|
||||
'data-oe-field="value" data-oe-type="monetary" '
|
||||
'data-oe-expression="obj.value">'
|
||||
'{symbol} '
|
||||
u'{symbol}\N{NO-BREAK SPACE}'
|
||||
'<span class="oe_currency_value">0.12</span>'
|
||||
'</span>'.format(
|
||||
obj=obj,
|
||||
symbol=currency.symbol.encode('utf-8')
|
||||
),)
|
||||
).encode('utf-8'),)
|
||||
|
||||
def test_currency_precision(self):
|
||||
""" Precision should be the currency's, not the float field's
|
||||
|
@ -168,10 +168,10 @@ class TestCurrencyExport(TestExport):
|
|||
'data-oe-field="value" data-oe-type="monetary" '
|
||||
'data-oe-expression="obj.value">'
|
||||
'<span class="oe_currency_value">0.12</span>'
|
||||
' {symbol}</span>'.format(
|
||||
u'\N{NO-BREAK SPACE}{symbol}</span>'.format(
|
||||
obj=obj,
|
||||
symbol=currency.symbol.encode('utf-8')
|
||||
),)
|
||||
).encode('utf-8'),)
|
||||
|
||||
class TestTextExport(TestBasicExport):
|
||||
def test_text(self):
|
||||
|
|
|
@ -246,9 +246,9 @@ class rml_parse(object):
|
|||
res = self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
|
||||
if currency_obj:
|
||||
if currency_obj.position == 'after':
|
||||
res='%s %s'%(res,currency_obj.symbol)
|
||||
res = u'%s\N{NO-BREAK SPACE}%s' % (res, currency_obj.symbol)
|
||||
elif currency_obj and currency_obj.position == 'before':
|
||||
res='%s %s'%(currency_obj.symbol, res)
|
||||
res = u'%s\N{NO-BREAK SPACE}%s' % (currency_obj.symbol, res)
|
||||
return res
|
||||
|
||||
def display_address(self, address_record, without_company=False):
|
||||
|
|
Loading…
Reference in New Issue