Tom Pickering has proposed merging 
lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update into 
lp:~openerp-community/openobject-addons/elico-6.1.

Requested reviews:
  OpenERP Community (openerp-community)

For more details, see:
https://code.launchpad.net/~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update/+merge/218432

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.
-- 
https://code.launchpad.net/~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update/+merge/218432
Your team OpenERP Community is requested to review the proposed merge of 
lp:~credativ/openobject-addons/elico-6.1-fixes-gap-analysis-price-update into 
lp:~openerp-community/openobject-addons/elico-6.1.
=== 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:59:58 +0000
@@ -390,10 +390,15 @@
     
     
     def _get_lines_from_workload(self, cr, uid, ids, context=None):
-        result = {}
-        for workload in self.pool.get('gap_analysis.workload').browse(cr, uid, ids, context=context):
-            result[workload.gap_line_id.id] = True
-        return result.keys()
+        line_ids = self.pool.get('gap_analysis.workload').read(cr, uid, ids, ['gap_line_id'], context=context)
+        return [line['gap_line_id'][0] for line in line_ids if line['gap_line_id']]
+
+
+    def _get_lines_from_gap_analysis(self, cr, uid, ids, context=None):
+        result = []
+        line_ids = self.pool.get('gap_analysis').read(cr, uid, ids, ['gap_lines'], context=context)
+        result = [line['gap_lines'] for line in line_ids]
+        return [val for sublist in result for val in sublist]
     
     
     def _total_workloads(self, cursor, uid, ids, arg, context=None):
@@ -454,7 +459,7 @@
         'category':      fields.many2one('gap_analysis.functionality.category', 'Category', required=True, select=True),
         'workloads':     fields.one2many('gap_analysis.workload', 'gap_line_id', 'Workloads'),
         '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),}),
-        '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),}),
+        '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),}),
         'openerp_fct':   fields.many2one('gap_analysis.openerp', 'OpenERP feature', select=True),
         'contributors':  fields.char('Contributor', size=256, help='Who is/are your main contact(s) to define this functionality.'),
         '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.'),
@@ -475,4 +480,4 @@
     
 gap_analysis_line()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'gap_analysis/wizard/import_from_sheet.py'
--- gap_analysis/wizard/import_from_sheet.py	2013-06-22 02:18:01 +0000
+++ gap_analysis/wizard/import_from_sheet.py	2014-05-06 13:59:58 +0000
@@ -30,7 +30,6 @@
 
 import xlrd
 from xlrd import open_workbook
-import xlutils.copy
 
 
 def getcell(rs, line, col, forceText=False):
@@ -455,7 +454,7 @@
                     'unknown_wk':  unknown_wk,
                     'is_tmpl':     True,
                     'proposed':    False,
-                    'testing':     gap_line.testing,
+                    'testing':     one_fct.testing,
                 }
                 fct_id = g_fct_pool.create(cr, uid, fct_vals)
                 print('Gap Import: Fct %s created (%s)'%(one_fct.functionality,fct_id))
@@ -473,7 +472,7 @@
                     'unknown_wk':  unknown_wk,
                     'is_tmpl':     True,
                     'proposed':    False,
-                    'testing':     gap_line.testing,
+                    'testing':     one_fct.testing,
                 }
                 g_fct_pool.write(cr, uid, [fct_id], fct_vals)
                 print('Gap Import: Fct %s found (%s) (%s)'%(one_fct.functionality,fct_id,fct_vals))

=== modified file 'gap_analysis/wizard/import_from_tmpl.py'
--- gap_analysis/wizard/import_from_tmpl.py	2013-06-22 02:18:01 +0000
+++ gap_analysis/wizard/import_from_tmpl.py	2014-05-06 13:59:58 +0000
@@ -54,7 +54,7 @@
                     'duration_wk':   gap_line.duration_wk,
                     'unknown_wk':    gap_line.unknown_wk,
                     'testing':       gap_line.testing,
-                    'category':      gap_line.category,
+                    'category':      gap_line.category.id,
                 }
                 gap_line_id = gap_line_pool.create(cr, uid, line_vals, context=context)
                 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp

Reply via email to