← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/openobject-addons/elico-7.0-fixes into lp:~openerp-community/openobject-addons/elico-7.0

 

Tom Pickering has proposed merging lp:~credativ/openobject-addons/elico-7.0-fixes into lp:~openerp-community/openobject-addons/elico-7.0.

Requested reviews:
  LIN Yu (lin-yu)

For more details, see:
https://code.launchpad.net/~credativ/openobject-addons/elico-7.0-fixes/+merge/200978

Estimated Selling Price is now recalculated when pricings are altered. Some efficiency improvements.
-- 
https://code.launchpad.net/~credativ/openobject-addons/elico-7.0-fixes/+merge/200978
Your team credativ is subscribed to branch lp:~credativ/openobject-addons/elico-7.0-fixes.
=== modified file 'gap_analysis/gap_analysis.py'
--- gap_analysis/gap_analysis.py	2013-10-18 14:48:42 +0000
+++ gap_analysis/gap_analysis.py	2014-01-09 10:17:17 +0000
@@ -381,12 +381,17 @@
     
     
     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]
+
+
+    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):
         result = {}
         for line in self.browse(cursor, uid, ids):
@@ -445,7 +450,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.'),
@@ -464,4 +469,4 @@
     _order = 'seq asc, code asc'
     _rec_name = 'code'
 
-# 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-10-17 14:46:43 +0000
+++ gap_analysis/wizard/import_from_sheet.py	2014-01-09 10:17:17 +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-10-18 14:37:46 +0000
+++ gap_analysis/wizard/import_from_tmpl.py	2014-01-09 10:17:17 +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)