diff options
| author | jam-openerp <jam@tinyerp.com> | 2011-01-05 15:42:59 +0530 |
|---|---|---|
| committer | jam-openerp <jam@tinyerp.com> | 2011-01-05 15:42:59 +0530 |
| commit | 54aa8e6e2033858e4030ef51247079bda26cb447 (patch) | |
| tree | 55a5fdedf607eca6815a092826293c9c35287976 /addons/project_long_term/project_long_term.py | |
| parent | 5dbdff512bf33795bd5948b5dbe599140d06e33d (diff) | |
[IMP] Project_long_term: Refactoring Scheduling Process.
bzr revid: jam@tinyerp.com-20110105101259-lmgth1kt56xsg5dq
Diffstat (limited to 'addons/project_long_term/project_long_term.py')
| -rw-r--r-- | addons/project_long_term/project_long_term.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 616d320ceef..933b6540e90 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -234,9 +234,10 @@ class project_phase(osv.osv): # Phases Defination for the Project s = ''' def Phase_%s(): + title = \"%s\" effort = \'%s\' resource = %s -'''%(phase.id, duration, str_vals or False) +'''%(phase.id, phase.name, duration, str_vals or False) if parent: start = 'up.Phase_%s.end' % (parent.id) s += ''' @@ -318,14 +319,16 @@ class project_phase(osv.osv): for key, vals in resource_objs.items(): cls_str +=''' class Resource_%s(Resource): + title = \"%s\" vacation = %s efficiency = %s -'''%(key, vals.get('vacation', False), vals.get('efficiency', False)) +'''%(key, vals.get('name',False), vals.get('vacation', False), vals.get('efficiency', False)) # Create a new project for each phase func_str += ''' def Phase_%d(): from resource.faces import Resource + title = \"%s\" start = \'%s\' minimum_time_unit = %s working_hours_per_day = %s @@ -334,7 +337,7 @@ def Phase_%d(): working_days_per_year = %s vacation = %s working_days = %s -'''%(phase.id, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) +'''%(phase.id, phase.name, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) func_str += cls_str parent = False task_ids = [] @@ -468,14 +471,16 @@ class project(osv.osv): for key, vals in resource_objs.items(): cls_str +=''' class Resource_%s(Resource): + title = \"%s\" vacation = %s efficiency = %s -'''%(key, vals.get('vacation', False), vals.get('efficiency', False)) +'''%(key, vals.get('name',False), vals.get('vacation', False), vals.get('efficiency', False)) # Create a new project for each phase func_str += ''' def Project_%d(): from resource.faces import Resource + title = \"%s\" start = \'%s\' minimum_time_unit = %s working_hours_per_day = %s @@ -484,7 +489,7 @@ def Project_%d(): working_days_per_year = %s vacation = %s working_days = %s -'''%(project.id, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) +'''%(project.id, project.name, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) func_str += cls_str phase_ids = [] for root_phase in phase_pool.browse(cr, uid, root_phase_ids, context=context): @@ -492,10 +497,10 @@ def Project_%d(): func_str += phases phase_ids += child_phase_ids #Temp File to test the Code for the Allocation - fn = '/home/tiny/Desktop/plt.py' - fp = open(fn, 'w') - fp.writelines(func_str) - fp.close() +# fn = '/home/tiny/Desktop/plt.py' +# fp = open(fn, 'w') +# fp.writelines(func_str) +# fp.close() # Allocating Memory for the required Project and Pahses and Resources exec(func_str) @@ -576,14 +581,16 @@ def Project_%d(): for key, vals in resource_objs.items(): cls_str +=''' class Resource_%s(Resource): + title = \"%s\" vacation = %s efficiency = %s -'''%(key, vals.get('vacation', False), vals.get('efficiency', False)) +'''%(key, vals.get('name',False), vals.get('vacation', False), vals.get('efficiency', False)) # Create a new project for each phase func_str += ''' def Project_%d(): from resource.faces import Resource + title = \"%s\" start = \'%s\' minimum_time_unit = %s working_hours_per_day = %s @@ -592,7 +599,7 @@ def Project_%d(): working_days_per_year = %s vacation = %s working_days = %s -'''%(project.id, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) +'''%(project.id, project.name, start, minimum_time_unit, working_hours_per_day, working_days_per_week, working_days_per_month, working_days_per_year, vacation, working_days ) func_str += cls_str parent = False task_ids = [] @@ -664,9 +671,10 @@ class project_task(osv.osv): if not flag: s = ''' def Task_%s(): + title = \"%s\" effort = \'%s\' resource = %s -'''%(task.id, duration, resource) +'''%(task.id, task.name, duration, resource) if parent: start = 'up.Task_%s.end' % (parent.id) s += ''' @@ -676,9 +684,10 @@ class project_task(osv.osv): else: s = ''' def Task_%s(): + title = \"%s\" effort = \'%s\' resource = %s -'''%(task.id, duration, resource) +'''%(task.id, task.name, duration, resource) if parent: start = 'up.Task_%s.end' % (parent.id) s += ''' |
