diff options
| author | mra (Open ERP) <mra@tinyerp.com> | 2010-03-16 15:00:14 +0530 |
|---|---|---|
| committer | mra (Open ERP) <mra@tinyerp.com> | 2010-03-16 15:00:14 +0530 |
| commit | 4f7ece5e75b7cb0dbd730fbb9f4a5119c5d7d7b2 (patch) | |
| tree | 64ff310fafe52ef5e2634d7e6d95a8cf3bc94411 /addons/project_long_term/wizard/compute_tasks_date.py | |
| parent | f256181d97f7cfda68797d83226993a9460ce69f (diff) | |
[IMP] project_long_term: improve the code
bzr revid: mra@tinyerp.com-20100316093014-m1t1z0nb8j05s8x9
Diffstat (limited to 'addons/project_long_term/wizard/compute_tasks_date.py')
| -rw-r--r-- | addons/project_long_term/wizard/compute_tasks_date.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/project_long_term/wizard/compute_tasks_date.py b/addons/project_long_term/wizard/compute_tasks_date.py index 1187980057b..42d8e6f9242 100644 --- a/addons/project_long_term/wizard/compute_tasks_date.py +++ b/addons/project_long_term/wizard/compute_tasks_date.py @@ -61,7 +61,7 @@ class wizard_compute_tasks(wizard.interface): ]) if task_ids: task_ids.sort() - task_objs = task_pool.browse(cr, uid, task_ids, context=context) + tasks = task_pool.browse(cr, uid, task_ids, context=context) calendar_id = project.resource_calendar_id.id start_date = project.date_start if not project.date_start: @@ -74,9 +74,10 @@ class wizard_compute_tasks(wizard.interface): time_efficiency = 1.0 resource_id = resource_obj.search(cr, uid, [('user_id', '=', user.id)]) if resource_id: - resource = resource_obj.browse(cr, uid, resource_id, context=context)[0] - leaves = wkcal.compute_leaves(cr, uid, calendar_id or False , resource_id, resource.calendar_id.id) - time_efficiency = resource.time_efficiency +# resource = resource_obj.browse(cr, uid, resource_id, context=context)[0] + resource = resource_obj.read(cr, uid, resource_id, ['calendar_id','time_efficiency'], context=context)[0] + leaves = wkcal.compute_leaves(cr, uid, calendar_id or False , resource_id, resource.get('calendar_id')[0]) + time_efficiency = resource.get('time_efficiency') resources.append(classobj(str(user.name), (Resource,), {'__doc__': user.name, '__name__': user.name, 'vacation': tuple(leaves), @@ -111,7 +112,7 @@ class wizard_compute_tasks(wizard.interface): vacation = tuple(wkcal.compute_leaves(cr, uid, calendar_id)) # Dynamic Creation of tasks i = 0 - for each_task in task_objs: + for each_task in tasks: hours = str(each_task.planned_hours / each_task.occupation_rate)+ 'H' if each_task.priority in priority_dict.keys(): priorty = priority_dict[each_task.priority] @@ -135,7 +136,7 @@ class wizard_compute_tasks(wizard.interface): ctx = context.copy() ctx.update({'scheduler': True}) user_id = user_obj.search(cr, uid, [('name', '=', t.booked_resource[0].__name__)]) - task_pool.write(cr, uid, [task_objs[loop_no-1].id], {'date_start': s_date.strftime('%Y-%m-%d %H:%M:%S'), + task_pool.write(cr, uid, [tasks[loop_no-1].id], {'date_start': s_date.strftime('%Y-%m-%d %H:%M:%S'), 'date_deadline': e_date.strftime('%Y-%m-%d %H:%M:%S'), 'user_id': user_id[0]}, context=ctx) |
