From f772b14b67b08c0c5bbc5f9c1c9fcdef572b08e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 5 May 2015 15:09:52 +0200 Subject: [PATCH] [IMP] mis_builder: use non-breaking hyphen for negative sign Also refactor _render_num() for readability. --- mis_builder/models/mis_builder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mis_builder/models/mis_builder.py b/mis_builder/models/mis_builder.py index b6bf5871..c773a773 100644 --- a/mis_builder/models/mis_builder.py +++ b/mis_builder/models/mis_builder.py @@ -206,14 +206,16 @@ class mis_report_kpi(orm.Model): divider_label = '' # format number following user language value = round(value / float(divider or 1), dp) or 0 - return u'%s\xA0%s%s' % (self.pool['res.lang'].format( + value = self.pool['res.lang'].format( cr, uid, lang_id, - '%%%s.%df' % ( - sign, dp), + '%%%s.%df' % (sign, dp), value, grouping=True, - context=context), - divider_label, suffix or '') + context=context) + value = u'%s\N{NO-BREAK SPACE}%s%s' % \ + (value, divider_label, suffix or '') + value = value.replace('-', u'\N{NON-BREAKING HYPHEN}') + return value class mis_report_query(orm.Model):