summaryrefslogtreecommitdiff
path: root/addons/project_long_term/wizard/project_compute_phases.py
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2011-10-26 01:31:41 +0200
committerFabien Pinckaers <fp@tinyerp.com>2011-10-26 01:31:41 +0200
commit0d2ae40a70ba3be3ccf8e439b4ed92a1ec4719d6 (patch)
tree9edce01a77687bc4f2c07b218c2bbffea35853cf /addons/project_long_term/wizard/project_compute_phases.py
parent68adb9de7e729dd5bb62ca9bc60c584d02ec3563 (diff)
[FIX] Complete refactoring of project_long_term, with following changes:
do not use resources but users on phases: - to be consistent with project members and task responsible - if the user is linked to a resource, it uses the calendar of the resource (holidays for example) better YML tests Complete rewrite of the scheduling mechanism: - Schedule phases: - write project.user.allocation based on scheduling - schedule resources based on members on the project - new constraint: force some users on a phase - Schedule tasks: - set user if no user on task - set start and end date some useability improvements We still have to work on better Gantt view but I think the scheduling is working correctly now. bzr revid: fp@tinyerp.com-20111025233141-cgctwe8spxhko2gn
Diffstat (limited to 'addons/project_long_term/wizard/project_compute_phases.py')
-rw-r--r--addons/project_long_term/wizard/project_compute_phases.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py
index 7e84f0681cc..57a1b3b6ed3 100644
--- a/addons/project_long_term/wizard/project_compute_phases.py
+++ b/addons/project_long_term/wizard/project_compute_phases.py
@@ -25,21 +25,19 @@ class project_compute_phases(osv.osv_memory):
_name = 'project.compute.phases'
_description = 'Project Compute Phases'
_columns = {
- 'target_project': fields.selection([('all', 'Compute All Projects'),
- ('one', 'Compute a Single Project'),
- ], 'Schedule', required = True),
-
+ 'target_project': fields.selection([
+ ('all', 'Compute All My Projects'),
+ ('one', 'Compute a Single Project'),
+ ], 'Schedule', required=True),
'project_id': fields.many2one('project.project', 'Project')
}
-
_defaults = {
- 'target_project': 'all'
+ 'target_project': 'one'
}
def check_selection(self, cr, uid, ids, context=None):
return self.compute_date(cr, uid, ids, context=context)
-
def compute_date(self, cr, uid, ids, context=None):
"""
Compute the phases for scheduling.
@@ -47,12 +45,12 @@ class project_compute_phases(osv.osv_memory):
project_pool = self.pool.get('project.project')
data = self.read(cr, uid, ids, [], context=context)[0]
if not data['project_id'] and data['target_project'] == 'one':
- raise osv.except_osv(_('Error!'), _('Please Specify Project to be schedule'))
+ raise osv.except_osv(_('Error!'), _('Please specify a project to schedule.'))
- if data['project_id']: # If project mentioned find its phases
+ if data['target_project'] == 'one':
project_ids = [data['project_id'][0]]
- else: # Else take all the draft,open,pending states phases
- project_ids = project_pool.search(cr, uid, [], context=context)
+ else:
+ project_ids = project_pool.search(cr, uid, [('user_id','=',uid)], context=context)
project_pool.schedule_phases(cr, uid, project_ids, context=context)
return self._open_phases_list(cr, uid, data, context=context)
@@ -70,8 +68,7 @@ class project_compute_phases(osv.osv_memory):
result = act_obj.read(cr, uid, [id], context=context)[0]
result['target'] = 'current'
project_id = data.get('project_id') and data.get('project_id')[0] or False
- result['context'] = {"search_default_project_id":project_id, "default_project_id":project_id, "search_default_responsible_id":uid, "search_default_current": 1}
+ result['context'] = {"search_default_project_id":project_id, "default_project_id":project_id, "search_default_current": 1}
return result
project_compute_phases()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: