Space as thousands separator does not show on reports

Bug #966083 reported by raphael alla
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Committed
Low
OpenERP Publisher's Warranty Team

Bug Description

the current code deletes all spaces from floats in reports. This was reported ages ago in #615403 but never fixed. The fix is extremely simple there is no reason not too fix it.

Here is a diff of the fix to the bug (we just need to remove the code that removes the white space)
=== modified file 'openerp/addons/base/res/res_lang.py'
--- openerp/addons/base/res/res_lang.py 2012-01-24 13:17:05 +0000
+++ openerp/addons/base/res/res_lang.py 2012-03-27 10:06:16 +0000
@@ -214,11 +214,6 @@
                 parts[0], seps = intersperse(parts[0], eval_lang_grouping, thousands_sep)

             formatted = decimal_point.join(parts)
- while seps:
- sp = formatted.find(' ')
- if sp == -1: break
- formatted = formatted[:sp] + formatted[sp+1:]
- seps -= 1
         elif percent[-1] in 'diu':
             if grouping:
                 formatted = intersperse(formatted, eval_lang_grouping, thousands_sep)[0]

Tags: maintenance

Related branches

Revision history for this message
raphael alla (raphael-alla-gmail) wrote :
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Rapheal,

I have completely checked your issue but fortunately all are working fine at my end.
I have set a separator format as a [3,2,-1] and thousand separator as a ',' which is generic way.

Now as per your issue I have changed the thousand separator as a ' ' and tried to print a report then again It takes a thousand separator as a ',' which is fine.

Would you please see attached a video and notify us where you faced the problem or may I did something wrong.

Thanks and waiting for your reply!

Revision history for this message
Amit Parik (amit-parik) wrote :
Changed in openobject-server:
status: New → Incomplete
Revision history for this message
raphael alla (raphael-alla-gmail) wrote :

Your video does not test the issue. I don't know how to record a video like you do, but I am trying to describe it more precisely.

In French, we use space as the thousands separator. So a number like 1234561 should be displayed as 1 234 561. Currently, in reports OpenErp deletes the space.

To reproduce the bug, do the following:
1/ in language, set the thousands separator as space (not empty, not comma - just one space)
2/ create an invoice with numbers > 1000
3/ try to print the report
=> the report does not display the space between thousands.

To be totally clear, I have attached two reports:
1 - current, wrong invoice
2 - expected invoice with proper display of the thousands separator

Revision history for this message
raphael alla (raphael-alla-gmail) wrote :

Expected result

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Raphael alla,

Thanks for your response.

I have tested your scenario and I also faced the space are not working on thousands separator as I mention in my comment#2 If we set a space as a thousands separator then current behaviour is not printed the space as a thousands separator but It's printed a comma instead of space.

You have suggested that in in French, space are used as the thousands separator.
I have also checked this with your given patch but also it's not working as you mention.
Indeed, as per the http://en.wikipedia.org/wiki/Decimal_mark link I also agree with you that we have to provided a space as a thousands separator.

That's why I am confirming this issue.

Thanks again!

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: Incomplete → Confirmed
Revision history for this message
raphael alla (raphael-alla-gmail) wrote :

Hello,

what was the issue you found with the patch? It is working well for us.

Cheers

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@raphael alla

This bug report is very interesting... thanks for investing this problem raphael !

I have set space as decimal separator for res_lang fr_FR (via SQL, because if you do it with the Gtk client it removes the trailing spaces). I have applied your patch on my OpenERP server 6.1. But it doesn't display the space as decimal separator in the Gtk client nor on the default invoice report.

Raphael, could you tell us more who we can make your patch work ? I would love to help you on this bug report.

Changed in openobject-server:
assignee: OpenERP's Framework R&D (openerp-dev-framework) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
Xavier Fernandez http://www.smile.fr (xav-fernandez) wrote :

An other solution to bypass the current limitation is to use an other space character as the usual space:
Unicode character U+2009 (http://en.wikipedia.org/wiki/Thin_Space) makes the trick as far as I remember, it won't be found by the sp = formatted.find(' ') line

Revision history for this message
raphael alla (raphael-alla-gmail) wrote : Re: [Bug 966083] Re: Space as thousands separator does not show on reports

Hello Alexis,

please check the following:
If you use a dot (.) instead of space; are numbers properly formatted; as
in: 1.234,56 ??
Is the field "sperator format" set properly to [3,3,3,3,3]?

Cheers

Raphael

2012/5/24 Alexis de Lattre <email address hidden>

> @raphael alla
>
> This bug report is very interesting... thanks for investing this problem
> raphael !
>
> I have set space as decimal separator for res_lang fr_FR (via SQL,
> because if you do it with the Gtk client it removes the trailing
> spaces). I have applied your patch on my OpenERP server 6.1. But it
> doesn't display the space as decimal separator in the Gtk client nor on
> the default invoice report.
>
> Raphael, could you tell us more who we can make your patch work ? I
> would love to help you on this bug report.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/966083
>
> Title:
> Space as thousands separator does not show on reports
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-server/+bug/966083/+subscriptions
>

--
Raphaël Alla
+687 78 86 86

Changed in openobject-server:
status: Confirmed → In Progress
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Hello,

I have fixed report issue in folowing branch, now reports will display space as thousand separator,
lp:~openerp-dev/openobject-server/6.1-opw-575181-rha
r4184 rid: <email address hidden>

More over, GTK client too doesn't display space as thousand separator for float values, so I have
created another fix for GTK,
lp:~openerp-dev/openobject-client/6.1-opw-575181-rha
r2064 <email address hidden>

Thanks for the bug report.
Regards,
Rifakat Haradwala

Changed in openobject-server:
status: In Progress → Fix Committed
Revision history for this message
Med Said BARA (diassynthesis) wrote :

Hello;

As described by Mr Raphael this bug is related to reports and not the Views in openerp (for views you can fix the separator in /Config/Translation/language/ .......
The Fix works fine for me.

The Question: WHY THIS BUG IS NOT DEFINITELY FIXED TILL TODAY.

Best regards.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Xavier

Thank for the solution that you posted in comment #9 ; it works like a charm (tested on OpenERP 7.0).
Here is how I implemented the solution :
1) open a python console and enter
>>> a=u'\u2009'
>>> print "b%sb"%a
b b
2) Copy paste the space that is between the 2 "b" into the "fr" language of OpenERP, in the "thousand separator" field.
3) Save. It should work !

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Unfortunately, the great tip I posted in comment #13 doesn't seem to work any more in Odoo v8

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Sorry for the noise, the tip is still working well on Odoo v8 (I forgot to set the "grouping" field to [3, 0] (this should be set by default !!!)

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Followup on my comment 13:

The problem with the unicode caracter 2009 (Thin space, cf http://www.fileformat.info/info/unicode/char/2009/index.htm) is that, when used as thousand separator, you may have some numbers over 1000 on 2 lines when your screen is not wide enough. Accounting users will get a headache !

A better solution is to use the unicode caracter "No break space" (http://www.fileformat.info/info/unicode/char/a0/index.htm), or better, the unicde caracter 202F "NARROW NO-BREAK SPACE" (http://www.fileformat.info/info/unicode/char/202f/index.htm)

So the solution in real life:
1) open a python console and enter:
>>> a=u'\u202f'
>>> repr(a)
"u'\\u202f'"
>>> print '|%s|' % a
| |
2) Copy paste the space that is between the 2 "|" into the "fr" language of Odoo, in the "Thousand Separator" field.
3) Save
4) reload the web page (F5)... it should work

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.