Merge lp:~openerp-dev/openobject-client-web/6.0-opw-596611-msh into lp:openobject-client-web

Proposed by Mohammed Shekha(Open ERP) on 2013-08-16
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-client-web/6.0-opw-596611-msh
Merge into: lp:openobject-client-web
Diff against target: 34 lines (+8/-2)
1 file modified
addons/openerp/controllers/tree.py (+8/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-596611-msh
Reviewer Review Type Date Requested Status
Xavier ALT 2013-08-16 Pending
Review via email: mp+180570@code.launchpad.net

Description of the change

Hello,

Fixed the issue of decimal not formatted according to language specification in tree view for float field.

Demo:-

1.Locale Code : en_US
2.Separator Format : [3,3,3,3,3,3,3,3]
3.Decimal Separator : . (dot)
4.Thousand Separator : , (point)

Goto Accounting -> Chart of accounts -> open chart of accounts from wizard -> tree view do not have grouping in float field value.

Thanks.

To post a comment you must log in.

Unmerged revisions

4916. By Mohammed Shekha<email address hidden> on 2013-08-16

[FIX]Fixed the issue of decimal not formatted according to language specification in tree view for float field.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/controllers/tree.py'
2--- addons/openerp/controllers/tree.py 2012-05-02 20:11:32 +0000
3+++ addons/openerp/controllers/tree.py 2013-08-16 13:57:14 +0000
4@@ -29,7 +29,7 @@
5
6 import actions
7
8-from openobject.i18n.format import format_datetime
9+from openobject.i18n.format import format_datetime, format_decimal
10 from openobject.tools import url, expose
11
12 from openerp.controllers import SecuredController
13@@ -38,7 +38,7 @@
14
15 FORMATTERS = {
16 'integer': lambda value, _i: '%s' % int(value),
17- 'float': lambda value, _i: '%.02f' % (value),
18+ 'float': lambda value, _i: format_decimal(float(value) or 0.0, _i and _i.get('digit')),
19 'date': lambda value, _i: format_datetime(value, 'date'),
20 'datetime': lambda value, _i: format_datetime(value, 'datetime'),
21 'one2one': lambda value, _i: value[1],
22@@ -193,6 +193,12 @@
23 field_info = simplejson.loads(fields_info[field])
24 if field_info.get('widget',''):
25 field_info['type'] = field_info['widget']
26+ if field_info.get('type') == 'float':
27+ digits = field_info.get('digits', (16,2))
28+ if isinstance(digits, basestring):
29+ digits = eval(digits)
30+ integer, digit = digits
31+ field_info['digit'] = digit
32 formatter = FORMATTERS.get(field_info['type'])
33 for x in result:
34 if x[field] and formatter: