Merge lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-aeroo-seq into lp:~openerp-community/openobject-addons/elico-6.1

Proposed by Tom Pickering
Status: Needs review
Proposed branch: lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-aeroo-seq
Merge into: lp:~openerp-community/openobject-addons/elico-6.1
Diff against target: 191 lines (+92/-7)
5 files modified
gap_analysis/gap_analysis.py (+6/-2)
gap_analysis_aeroo_report/report/gap_analysis_report.py (+54/-1)
gap_analysis_aeroo_report/wizard/wizard_view.py (+22/-1)
gap_analysis_aeroo_report/wizard/wizard_view.xml (+9/-2)
gap_analysis_project_long_term/gap_analysis_project_long_term.py (+1/-1)
To merge this branch: bzr merge lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-aeroo-seq
Reviewer Review Type Date Requested Status
OpenERP Community (OBSOLETE) Pending
Review via email: mp+218427@code.launchpad.net

Description of the change

This branch includes changes which allow users to specify the ordering of rows in the Gap Analysis Aeroo Report. The user is able to specify one of several sorting modes based on Phase, Category and Critical Level.

To post a comment you must log in.

Unmerged revisions

17. By Jacob Hicks (credativ)

[IMP] Add functionality to sort by critical level and incorporate this in to the other sorting mechanisms

16. By Tom Pickering

[IMP] Further UI tweaks - re-wording and re-positioning of UI elements.

15. By Tom Pickering

[IMP] Changes to UI layout and design to improve clarity.

14. By Tom Pickering

[FIX] The 'seq' field is now zero-padded so alphabetic sorting is accurate.

13. By Tom Pickering

[FIX] Sorting can now handle floating-point representations of phases. In addition, sequence sorting is now alphabetically by 'seq'.

12. By Tom Pickering

[FIX] Exported report lines are now sorted on category sequence rather than 'seq' field.

11. By Tom Pickering

[IMP] Gap Analysis aeroo report lines can now be sorted by sequence then phase, or by phase then sequence.

10. By Tom Pickering

[IMP] Lines in exported aeroo reports are now sorted based on phase and functionality category sequence.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gap_analysis/gap_analysis.py'
--- gap_analysis/gap_analysis.py 2013-06-22 02:18:01 +0000
+++ gap_analysis/gap_analysis.py 2014-05-06 13:40:19 +0000
@@ -228,6 +228,10 @@
228 if type(ids) != type([]):228 if type(ids) != type([]):
229 ids = [ids]229 ids = [ids]
230 230
231 cat_ids = gap_cat_pool.search(cr, uid, [], context=context)
232 seq_components = gap_cat_pool.read(cr, uid, cat_ids, ['sequence'], context=context)
233 max_seq_len = max([len(str(c['sequence'])) for c in seq_components])
234
231 for gap_id in ids:235 for gap_id in ids:
232 cr.execute("SELECT DISTINCT c.code FROM gap_analysis_line l, gap_analysis_functionality_category c WHERE l.category=c.id AND l.gap_id = %s",(gap_id,))236 cr.execute("SELECT DISTINCT c.code FROM gap_analysis_line l, gap_analysis_functionality_category c WHERE l.category=c.id AND l.gap_id = %s",(gap_id,))
233 categ_codes = map(lambda x: x[0], cr.fetchall()) or []237 categ_codes = map(lambda x: x[0], cr.fetchall()) or []
@@ -243,7 +247,7 @@
243 current_categ = categ247 current_categ = categ
244 seq = ''248 seq = ''
245 while current_categ:249 while current_categ:
246 seq = str(current_categ.sequence) + seq250 seq = str(current_categ.sequence).zfill(max_seq_len) + seq
247 current_categ = current_categ.parent_id or False251 current_categ = current_categ.parent_id or False
248 252
249 line_ids = gapline_pool.search(cr, uid, [('category','=',categ.id),('gap_id','=',gap_id)], order='critical desc, effort asc') or []253 line_ids = gapline_pool.search(cr, uid, [('category','=',categ.id),('gap_id','=',gap_id)], order='critical desc, effort asc') or []
@@ -475,4 +479,4 @@
475 479
476gap_analysis_line()480gap_analysis_line()
477481
478# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
479\ No newline at end of file482\ No newline at end of file
483# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
480484
=== modified file 'gap_analysis_aeroo_report/report/gap_analysis_report.py'
--- gap_analysis_aeroo_report/report/gap_analysis_report.py 2013-06-22 02:18:01 +0000
+++ gap_analysis_aeroo_report/report/gap_analysis_report.py 2014-05-06 13:40:19 +0000
@@ -76,7 +76,59 @@
76 context.update({'workload_type_list':ranges_list})76 context.update({'workload_type_list':ranges_list})
77 return result 77 return result
78 78
79
80 def sort_lines_by_phase(self, lines, context=None):
81 lines_with_num_phase = []
82 lines_with_alpha_phase = []
83 for l in lines:
84 try:
85 float(l.phase)
86 lines_with_num_phase.append(l)
87 except ValueError:
88 lines_with_alpha_phase.append(l)
89
90 sorted_num_phase = sorted(lines_with_num_phase , key=lambda l: float(l.phase))
91 sorted_alpha_phase = sorted(lines_with_alpha_phase, key=lambda l: l.phase )
92 return sorted_num_phase + sorted_alpha_phase
93
94
95 def sort_lines_by_seq(self, lines, context=None):
96 if not context:
97 context = {}
98
99 return sorted(lines, key=lambda l: l.seq)
100
101 def sort_lines_by_crit(self, lines, context=None):
102 if not context:
103 context = {}
104
105 return sorted(lines, key=lambda l: l.critical, reverse=True)
106
107 def sort_lines(self, lines, context=None):
108 if not context:
109 context = {}
110
111 sort_mode = context.get('sort_mode', 'phaseseq')
112
113 # Because 'sorted' is guaranteed to be stable,
114 # sorting by each key from the hierarchically lowest first
115 # sorts lines as required.
116 sorted_lines = []
117 if sort_mode == 'phasecritseq':
118 sorted_lines = self.sort_lines_by_seq(lines, context=context)
119 sorted_lines = self.sort_lines_by_crit(lines, context=context)
120 sorted_lines = self.sort_lines_by_phase(sorted_lines[:], context=context)
121 elif sort_mode == 'seqphasecrit':
122 sorted_lines = self.sort_lines_by_crit(lines, context=context)
123 sorted_lines = self.sort_lines_by_phase(lines, context=context)
124 sorted_lines = self.sort_lines_by_seq(sorted_lines[:], context=context)
125 if sort_mode == 'critphaseseq':
126 sorted_lines = self.sort_lines_by_seq(lines, context=context)
127 sorted_lines = self.sort_lines_by_phase(sorted_lines[:], context=context)
128 sorted_lines = self.sort_lines_by_crit(lines, context=context)
129 return sorted_lines
79 130
131
80 def get_lines(self, context=None):132 def get_lines(self, context=None):
81 if not context:133 if not context:
82 context = {}134 context = {}
@@ -99,7 +151,8 @@
99 if active_id:151 if active_id:
100 # First we get all the used category for this Gap Analysis152 # First we get all the used category for this Gap Analysis
101 active_gap = gap_pool.browse(self.cr, self.uid, active_id)153 active_gap = gap_pool.browse(self.cr, self.uid, active_id)
102 for one_line in active_gap.gap_lines:154 ordered = self.sort_lines(active_gap.gap_lines, context=context)
155 for one_line in ordered:
103 res = {}156 res = {}
104 157
105 res['functionality'] = one_line.functionality.name158 res['functionality'] = one_line.functionality.name
106159
=== modified file 'gap_analysis_aeroo_report/wizard/wizard_view.py'
--- gap_analysis_aeroo_report/wizard/wizard_view.py 2013-06-22 02:18:01 +0000
+++ gap_analysis_aeroo_report/wizard/wizard_view.py 2014-05-06 13:40:19 +0000
@@ -21,16 +21,37 @@
21##############################################################################21##############################################################################
2222
23from osv import osv, fields23from osv import osv, fields
24from osv.osv import except_osv
24from tools.translate import _25from tools.translate import _
2526
26class gap_analysis_wizard(osv.osv_memory):27class gap_analysis_wizard(osv.osv_memory):
27 _name='gap_analysis.gap_analysis_wizard'28 _name='gap_analysis.gap_analysis_wizard'
29
30 def _get_sort_modes(self, cr, uid, context=None):
31 return [('phasecritseq','Group by Phase'),('seqphasecrit', 'Group by Category'),('critphaseseq', 'Group by Critical Level')]
32
33 _columns = {
34 'sort_mode' : fields.selection(_get_sort_modes, string='Sorting', help='Use \'Group by Phase\' for generating a customer facing implementation breakdown. Use \'Group by Category\' for for planning the complete implementation for a single module (e.g. sales).'),
35 }
36
37 _defaults = {
38 'sort_mode' : _get_sort_modes(None, None, None)[0],
39 }
28 40
29 def print_xls(self, cr, uid, ids, context=None):41 def print_xls(self, cr, uid, ids, context=None):
30 if context is None:42 if context is None:
31 context = {}43 context = {}
32 44
33 data = {'model':'gap_analysis', 'ids':context.get('active_ids', []), 'id':ids[0], 'report_type': 'aeroo'}45 data = {'model':'gap_analysis', 'ids':context.get('active_ids', []), 'id':ids[0], 'report_type': 'aeroo'}
46 sort_mode = self.read(cr, uid, ids, ['sort_mode'], context=context)[0]['sort_mode']
47
48 if not sort_mode:
49 raise except_osv(
50 _('Error: Sort Mode Unspecified'),
51 _('Please select a sort mode from the selection box.')
52 )
53 else:
54 context.update(sort_mode=sort_mode)
34 55
35 return {56 return {
36 'type': 'ir.actions.report.xml',57 'type': 'ir.actions.report.xml',
@@ -58,4 +79,4 @@
58 }79 }
59gap_analysis_tasks_list()80gap_analysis_tasks_list()
6081
61# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
62\ No newline at end of file82\ No newline at end of file
83# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
6384
=== modified file 'gap_analysis_aeroo_report/wizard/wizard_view.xml'
--- gap_analysis_aeroo_report/wizard/wizard_view.xml 2013-06-22 02:18:01 +0000
+++ gap_analysis_aeroo_report/wizard/wizard_view.xml 2014-05-06 13:40:19 +0000
@@ -8,7 +8,14 @@
8 <field name="arch" type="xml">8 <field name="arch" type="xml">
9 <form string="Gap Analysis Report Wizard">9 <form string="Gap Analysis Report Wizard">
10 <newline/>10 <newline/>
11 <group col="4" colspan="4">11 <label colspan="4" nolabel="1" string="You can export a summary of the complete Gap Analysis to a spreadsheet for further checking or analysis."/>
12 <group col="1" colspan="2"/>
13 <group col="2" colspan="2">
14 <field name="sort_mode" colspan="2"/>
15 </group>
16 <separator colspan="4"/>
17 <group col="1" colspan="2"/>
18 <group col="2" colspan="2">
12 <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/>19 <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/>
13 <button icon="gtk-print" name="print_xls" string="Generate XLS" type="object" colspan="1" default_focus="1" />20 <button icon="gtk-print" name="print_xls" string="Generate XLS" type="object" colspan="1" default_focus="1" />
14 </group>21 </group>
@@ -76,4 +83,4 @@
76 target="new"83 target="new"
77 key2="client_action_multi" />84 key2="client_action_multi" />
78 </data>85 </data>
79</openerp>
80\ No newline at end of file86\ No newline at end of file
87</openerp>
8188
=== modified file 'gap_analysis_project_long_term/gap_analysis_project_long_term.py'
--- gap_analysis_project_long_term/gap_analysis_project_long_term.py 2013-06-22 02:18:01 +0000
+++ gap_analysis_project_long_term/gap_analysis_project_long_term.py 2014-05-06 13:40:19 +0000
@@ -218,4 +218,4 @@
218 218
219gap_analysis_line()219gap_analysis_line()
220220
221# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
222\ No newline at end of file221\ No newline at end of file
222# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches