← Back to team overview

openerp-community team mailing list archive

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

 

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

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/95856
-- 
https://code.launchpad.net/~openerp-community/openobject-addons/fix_726185_trunk/+merge/95856
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/fix_726185_trunk.
=== modified file 'project/project.py'
--- project/project.py	2012-02-15 14:51:12 +0000
+++ project/project.py	2012-03-05 07:56:26 +0000
@@ -1082,6 +1082,11 @@
 %s  resource = %s
 ''' % (ident, 'User_'+str(task.user_id.id))
 
+            # http://faces.homeip.net/doc/node66.html
+            priority = 500 + (50 - 10 * int(task.priority))
+            result += '''%s  priority = %s
+''' % (ident, str(priority))
+
         result += "\n"
         return result
 

=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py	2012-01-31 13:36:57 +0000
+++ project_long_term/project_long_term.py	2012-03-05 07:56:26 +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,17 @@
                     '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:
+                        if task.state != 'done' and task.state != 'cancelled':
+                            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-03-05 07:56:26 +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, [('state', '!=', 'template')], context=context)
         else:
             project_ids = project_pool.search(cr, uid, [('user_id','=',uid)], context=context)
 

=== modified file 'project_long_term/wizard/project_compute_phases_view.xml'
--- project_long_term/wizard/project_compute_phases_view.xml	2011-10-27 21:11:24 +0000
+++ project_long_term/wizard/project_compute_phases_view.xml	2012-03-05 07:56:26 +0000
@@ -11,7 +11,7 @@
                     <group colspan="4" col="4">
                         <separator colspan="4" string="Schedule Phases" />
                         <field name="target_project" colspan="4"/>
-                        <field name="project_id" colspan="4" attrs="{'invisible':[('target_project','=','all')], 'required':[('target_project','!=','all')]}"/>
+                        <field name="project_id" colspan="4" attrs="{'invisible':['|',('target_project','=','all'),('target_project','=','my')], 'required':[('target_project','!=','all'),('target_project','!=','my')]}"/>
                         <separator colspan="4"/>
                         <group colspan="2" col="2">
                         </group>