diff options
| author | Harry (OpenERP) <hmo@tinyerp.com> | 2010-09-27 20:01:10 +0530 |
|---|---|---|
| committer | Harry (OpenERP) <hmo@tinyerp.com> | 2010-09-27 20:01:10 +0530 |
| commit | 49dd7429919c7a59596e31d9554d7630d282d735 (patch) | |
| tree | 4060dd5d4dcc53febe0eba39f5f8e31ae0e95fa0 /addons/project_long_term/project_long_term.py | |
| parent | 9f924e8358a0719a066ddf0d639ff667a45bc88e (diff) | |
| parent | 0b3dab94db2a7bba1adbc9163dc8e292e4ad8cf4 (diff) | |
[MERGE] merged from openobject-addons
bzr revid: hmo@tinyerp.com-20100927143110-2yvjrm02umgglql9
Diffstat (limited to 'addons/project_long_term/project_long_term.py')
| -rw-r--r-- | addons/project_long_term/project_long_term.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index be0eb07bd47..a535015d067 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -291,11 +291,16 @@ class project_phase(osv.osv): # Create a new project for each phase def Project(): start = start_date + minimum_time_unit = 1 + resource = phase_resource_obj # If project has working calendar then that # else the default one would be considered if calendar_id: - resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) - resource_pool.compute_vacation(cr, uid, calendar_id) + working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) + vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id)) + + def phase(): + effort = duration project = Task.BalancedProject(Project) s_date = project.phase.start.to_datetime() @@ -334,6 +339,7 @@ class project_phase(osv.osv): Schedule the tasks according to resource available and priority. """ task_pool = self.pool.get('project.task') + resource_pool = self.pool.get('resource.resource') if context is None: context = {} resources_list = self.generate_resources(cr, uid, ids, context=context) @@ -425,7 +431,9 @@ class project(osv.osv): """ if type(ids) in (long, int,): ids = [ids] + user_pool = self.pool.get('res.users') task_pool = self.pool.get('project.task') + resource_pool = self.pool.get('resource.resource') if context is None: context = {} @@ -484,7 +492,7 @@ class project_task(osv.osv): if context is None: context = {} user_pool = self.pool.get('res.users') - resource_pool = self.pool.get('resource.resource') + project_pool = self.pool.get('project.project') priority_dict = {'0': 1000, '1': 800, '2': 500, '3': 300, '4': 100} # Create dynamic no of tasks with the resource specified def create_tasks(task_number, eff, priorty=500, obj=False): @@ -492,23 +500,28 @@ class project_task(osv.osv): """ task is a dynamic method! """ + effort = eff if obj: resource = obj + priority = priorty task.__doc__ = "TaskNO%d" %task_number task.__name__ = "task%d" %task_number return task # Create a 'Faces' project with all the tasks and resources def Project(): + title = "Project" + start = datetime.strftime(datetime.strptime(start_date, "%Y-%m-%d"), "%Y-%m-%d %H:%M") try: resource = reduce(operator.or_, resources) except: raise osv.except_osv(_('Error'), _('Should have Resources Allocation or Project Members!')) - + minimum_time_unit = 1 if calendar_id: # If project has working calendar - resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) - resource_pool.compute_vacation(cr, uid, calendar_id, context=context) + working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context) + vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id, context=context)) # Dynamic creation of tasks + task_number = 0 for openobect_task in self.browse(cr, uid, ids, context=context): hours = str(openobect_task.planned_hours )+ 'H' if openobect_task.priority in priority_dict.keys(): @@ -542,7 +555,5 @@ class project_task(osv.osv): loop_no += 1 return True - project_task() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
