~jfb-tempo-consulting/unifield-web/US-1759

« back to all changes in this revision

Viewing changes to openobject/i18n/format.py

  • Committer: jf
  • Date: 2020-11-02 10:08:40 UTC
  • mfrom: (4997.4.4 web-RR23)
  • Revision ID: jfb@tempo-consulting.fr-20201102100840-y8tg9tww3htb7dsi
Tags: uf19.0rc1, uf19.0rc2
US-7940 [IMP] Replenishment Rules 2.3
  - leave form: do not warn for pager limit or tick boxes on lines
  - computation=-1 to truncate 0 in decimals
  - lead times css

lp:~jfb-tempo-consulting/unifield-web/US-7940

Show diffs side-by-side

added added

removed removed

Lines of Context:
307
307
    if kwargs.get('computation', False):
308
308
        # fixed min decimal value
309
309
        min_digits = 2
 
310
        if kwargs['computation'] == -1:
 
311
            min_digits = 0
310
312
        # remove trailing zeros
311
313
        decimals = decimals.rstrip('0')
312
314
        # if less than two digits, we add padding - possible improvement, add the padding size in the decimal precision object
313
315
        if len(decimals) < min_digits:
314
316
            decimals = decimals + '0'*(min_digits - len(decimals))
315
 
 
 
317
        if not decimals:
 
318
            return val
316
319
    result = val + unicode(numbers.get_decimal_symbol(locale) + decimals)
317
320
    return result
318
321