Merge lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update 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-price-update
Merge into: lp:~openerp-community/openobject-addons/elico-6.1
Diff against target: 81 lines (+14/-10)
3 files modified
gap_analysis/gap_analysis.py (+11/-6)
gap_analysis/wizard/import_from_sheet.py (+2/-3)
gap_analysis/wizard/import_from_tmpl.py (+1/-1)
To merge this branch: bzr merge lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update
Reviewer Review Type Date Requested Status
OpenERP Community (OBSOLETE) Pending
Review via email: mp+218432@code.launchpad.net

Description of the change

This branch addresses an issue in the Gap Analysis module whereby the 'Estimated Selling Price' of a Gap Analysis wasn't updated if any of the 'Functional Analysis', 'Technical Analysis' or 'Effort' price fields on the Gap Analysis were updated. It also includes some small changes to decrease the number of database queries required to calculate this value.

To post a comment you must log in.

Unmerged revisions

15. By Tom Pickering

[FIX] No more tracebacks when trying to save a functionality template which has workloads.

14. By Tom Pickering

[REF] Removal of extraneous comment.

13. By Tom Pickering

[IMP] Efficiency improvement during calculation of Estimated Selling Price.

12. By Tom Pickering

[IMP] Efficiency improvement regarding interaction with database.

11. By Tom Pickering

[FIX] Recalculates Estimated Selling Price if prices are modified.

10. By Tom Pickering

[FIX] Fixed an exception raised by wizard import functionality, and removed unused python module import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gap_analysis/gap_analysis.py'
2--- gap_analysis/gap_analysis.py 2013-06-22 02:18:01 +0000
3+++ gap_analysis/gap_analysis.py 2014-05-06 13:59:58 +0000
4@@ -390,10 +390,15 @@
5
6
7 def _get_lines_from_workload(self, cr, uid, ids, context=None):
8- result = {}
9- for workload in self.pool.get('gap_analysis.workload').browse(cr, uid, ids, context=context):
10- result[workload.gap_line_id.id] = True
11- return result.keys()
12+ line_ids = self.pool.get('gap_analysis.workload').read(cr, uid, ids, ['gap_line_id'], context=context)
13+ return [line['gap_line_id'][0] for line in line_ids if line['gap_line_id']]
14+
15+
16+ def _get_lines_from_gap_analysis(self, cr, uid, ids, context=None):
17+ result = []
18+ line_ids = self.pool.get('gap_analysis').read(cr, uid, ids, ['gap_lines'], context=context)
19+ result = [line['gap_lines'] for line in line_ids]
20+ return [val for sublist in result for val in sublist]
21
22
23 def _total_workloads(self, cursor, uid, ids, arg, context=None):
24@@ -454,7 +459,7 @@
25 'category': fields.many2one('gap_analysis.functionality.category', 'Category', required=True, select=True),
26 'workloads': fields.one2many('gap_analysis.workload', 'gap_line_id', 'Workloads'),
27 'total_time': fields.function(_estimated_line_time_cost, method=True, type='float', multi=True, string='Estimated Time', store = {'gap_analysis.line': (lambda self, cr, uid, ids, c={}: ids, ['testing','workloads','duration_wk','effort','unknown_wk'], 10),'gap_analysis.workload': (_get_lines_from_workload, ['workload', 'duration'], 10),}),
28- 'total_cost': fields.function(_estimated_line_time_cost, method=True, type='float', multi=True, string='Estimated Selling Price', store = {'gap_analysis.line': (lambda self, cr, uid, ids, c={}: ids, ['testing','workloads','duration_wk','effort','unknown_wk'], 10),'gap_analysis.workload': (_get_lines_from_workload, ['workload', 'duration'], 10),}),
29+ 'total_cost': fields.function(_estimated_line_time_cost, method=True, type='float', multi=True, string='Estimated Selling Price', store = {'gap_analysis.line': (lambda self, cr, uid, ids, c={}: ids, ['testing','workloads','duration_wk','effort','unknown_wk'], 10),'gap_analysis': (_get_lines_from_gap_analysis, ['func_cost','tech_cost','dev_cost'], 10),'gap_analysis.workload': (_get_lines_from_workload, ['workload', 'duration'], 10),}),
30 'openerp_fct': fields.many2one('gap_analysis.openerp', 'OpenERP feature', select=True),
31 'contributors': fields.char('Contributor', size=256, help='Who is/are your main contact(s) to define this functionality.'),
32 'keep': fields.boolean('Keep ?', help='Keep the functionality in the Gap Analysis. If unchecked, the functionality will be print in the report but not used for the price calculation.'),
33@@ -475,4 +480,4 @@
34
35 gap_analysis_line()
36
37-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
38\ No newline at end of file
39+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
40
41=== modified file 'gap_analysis/wizard/import_from_sheet.py'
42--- gap_analysis/wizard/import_from_sheet.py 2013-06-22 02:18:01 +0000
43+++ gap_analysis/wizard/import_from_sheet.py 2014-05-06 13:59:58 +0000
44@@ -30,7 +30,6 @@
45
46 import xlrd
47 from xlrd import open_workbook
48-import xlutils.copy
49
50
51 def getcell(rs, line, col, forceText=False):
52@@ -455,7 +454,7 @@
53 'unknown_wk': unknown_wk,
54 'is_tmpl': True,
55 'proposed': False,
56- 'testing': gap_line.testing,
57+ 'testing': one_fct.testing,
58 }
59 fct_id = g_fct_pool.create(cr, uid, fct_vals)
60 print('Gap Import: Fct %s created (%s)'%(one_fct.functionality,fct_id))
61@@ -473,7 +472,7 @@
62 'unknown_wk': unknown_wk,
63 'is_tmpl': True,
64 'proposed': False,
65- 'testing': gap_line.testing,
66+ 'testing': one_fct.testing,
67 }
68 g_fct_pool.write(cr, uid, [fct_id], fct_vals)
69 print('Gap Import: Fct %s found (%s) (%s)'%(one_fct.functionality,fct_id,fct_vals))
70
71=== modified file 'gap_analysis/wizard/import_from_tmpl.py'
72--- gap_analysis/wizard/import_from_tmpl.py 2013-06-22 02:18:01 +0000
73+++ gap_analysis/wizard/import_from_tmpl.py 2014-05-06 13:59:58 +0000
74@@ -54,7 +54,7 @@
75 'duration_wk': gap_line.duration_wk,
76 'unknown_wk': gap_line.unknown_wk,
77 'testing': gap_line.testing,
78- 'category': gap_line.category,
79+ 'category': gap_line.category.id,
80 }
81 gap_line_id = gap_line_pool.create(cr, uid, line_vals, context=context)
82

Subscribers

People subscribed via source and target branches