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

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-client-web/6.0-opw-593396-msh
Merge into: lp:openobject-client-web
Diff against target: 26 lines (+8/-1)
1 file modified
addons/view_graph/widgets/_graph.py (+8/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/6.0-opw-593396-msh
Reviewer Review Type Date Requested Status
Xavier ALT Pending
Review via email: mp+169107@code.launchpad.net

Description of the change

Hello,

Fixed the issue of month sorting on graph axis, if the field type is selection type then it should not be sorted alphabetically instead it should be displayed as it has been defined in code because selection field generally have ordered data like state, month etc. if there is state then it should be displayed as it is defined in the code, generally state defined in order of process which going to execute like draft, then confirm etc.

Demo:- Purchase -> Purchase Dashboard -> see the graph view x-axis has month, month comes in alphabetical order, it should be come in the order it is defined, also state field should also come in ther order it is defined(generally selection field have the data which is in particular order say for example state, it is defined in the code according to its execution sequence in process 1. draft, 2. confirm, 3. done).

So restrict alphabetical sorting on selection field for graph view axis.

Thanks.

To post a comment you must log in.

Unmerged revisions

4914. By Mohammed Shekha<email address hidden>

[FIX]Fixed the issue of month sorting on graph axis, if the field type is selection type then it should not be sorted alphabetically instead it should be displayed as it has been defined in code because selection field generally have ordered data like state, month etc. if there is state then it should be displayed as it is defined in the code, generally state defined in order of process which going to execute like draft, then confirm etc.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/view_graph/widgets/_graph.py'
2--- addons/view_graph/widgets/_graph.py 2011-02-02 11:23:42 +0000
3+++ addons/view_graph/widgets/_graph.py 2013-06-13 05:30:35 +0000
4@@ -196,6 +196,8 @@
5 fields[name].update(attrs) # Update fields ...
6
7 attrs['string'] = fields[name]['string']
8+ if fields[name].get('type', False) == 'selection':
9+ attrs['selection'] = fields[name]['selection']
10
11 axis.append(ustr(name))
12 axis_data[ustr(name)] = attrs
13@@ -270,7 +272,12 @@
14 keys = keys.keys()
15 keys.sort()
16
17- for l in sorted(label.iterkeys()):
18+ if 'selection' in axis_data[axis[0]]:
19+ act_sel = axis_data[axis[0]].get('selection', False)
20+ label = [y for x, y in act_sel if y in label.keys()]
21+ else:
22+ label = sorted(label.iterkeys())
23+ for l in label:
24 x = 0
25 for i in total_ids:
26 if i.get('prod_id') == l and x == 0: