← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-community/openobject-addons/fix_726185_trunk into lp:openobject-addons

 

Lorenzo Battistini - Agile BG - Domsense has proposed merging lp:~openerp-community/openobject-addons/fix_726185_trunk into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #726185 in OpenERP Addons: "long term scheduling doesn't work across projects"
  https://bugs.launchpad.net/openobject-addons/+bug/726185

For more details, see:
https://code.launchpad.net/~openerp-community/openobject-addons/fix_726185_trunk/+merge/88996
-- 
https://code.launchpad.net/~openerp-community/openobject-addons/fix_726185_trunk/+merge/88996
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/fix_726185_trunk.
=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py	2011-12-21 22:15:04 +0000
+++ project_long_term/project_long_term.py	2012-01-18 10:13:24 +0000
@@ -222,6 +222,8 @@
         context = context or {}
         if type(ids) in (long, int,):
             ids = [ids]
+        task_pool = self.pool.get('project.task')        
+        resource_pool = self.pool.get('resource.resource')
         projects = self.browse(cr, uid, ids, context=context)
         result = self._schedule_header(cr, uid, ids, context=context)
         for project in projects:
@@ -256,6 +258,16 @@
                     'date_start': p.start.strftime('%Y-%m-%d %H:%M:%S'),
                     'date_end': p.end.strftime('%Y-%m-%d %H:%M:%S')
                 }, context=context)
+                
+                if phase.task_ids:
+                    for task in phase.task_ids:
+                        vals = {}
+                        #Getting values of the Tasks
+                        temp = eval("p.Task_%s"%task.id)                                               
+                        vals.update({'date_start' : temp.start.strftime('%Y-%m-%d %H:%M:%S')})
+                        vals.update({'date_end' : temp.end.strftime('%Y-%m-%d %H:%M:%S')})
+                        task_pool.write(cr, uid, task.id, vals, context=context)
+                        
         return True
 project()
 

=== modified file 'project_long_term/wizard/project_compute_phases.py'
--- project_long_term/wizard/project_compute_phases.py	2011-12-19 16:54:40 +0000
+++ project_long_term/wizard/project_compute_phases.py	2012-01-18 10:13:24 +0000
@@ -26,7 +26,8 @@
     _description = 'Project Compute Phases'
     _columns = {
         'target_project': fields.selection([
-            ('all', 'Compute All My Projects'),
+            ('all', 'Compute All Projects'),
+            ('my', 'Compute All My Projects'),
             ('one', 'Compute a Single Project'),
             ], 'Schedule', required=True),
         'project_id': fields.many2one('project.project', 'Project')
@@ -49,6 +50,8 @@
 
         if data['target_project'] == 'one':
             project_ids = [data['project_id'][0]]
+        elif data['target_project'] == 'all':
+            project_ids = project_pool.search(cr, uid, [], context=context)
         else:
             project_ids = project_pool.search(cr, uid, [('user_id','=',uid)], context=context)