Browse Source

[IMP] mis_builder: use non-breaking hyphen for negative sign

Also refactor _render_num() for readability.
pull/86/head
Stéphane Bidoul 10 years ago
parent
commit
f772b14b67
  1. 12
      mis_builder/models/mis_builder.py

12
mis_builder/models/mis_builder.py

@ -206,14 +206,16 @@ class mis_report_kpi(orm.Model):
divider_label = '' divider_label = ''
# format number following user language # format number following user language
value = round(value / float(divider or 1), dp) or 0 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, cr, uid, lang_id,
'%%%s.%df' % (
sign, dp),
'%%%s.%df' % (sign, dp),
value, value,
grouping=True, 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): class mis_report_query(orm.Model):

Loading…
Cancel
Save