From 8173762fa4cfea3f87b97984bf1865671e195ae4 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Wed, 10 Feb 2010 16:28:27 +0530 Subject: [PATCH 1/2] [IMP]:Changes in tasks and phases according to working calendar of project bzr revid: rvo@tinyerp.co.in-20100210105827-5hofq1ageft6s2hm --- addons/project/wizard/compute_tasks_date.py | 7 +++---- addons/project_long_term/wizard/compute_phases_date.py | 8 +++++--- addons/resource/faces/task.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/project/wizard/compute_tasks_date.py b/addons/project/wizard/compute_tasks_date.py index b9991fbe448..2abd7411135 100644 --- a/addons/project/wizard/compute_tasks_date.py +++ b/addons/project/wizard/compute_tasks_date.py @@ -154,7 +154,7 @@ class wizard_compute_tasks(wizard.interface): for no in range(len(resource)): leaves = [] resource_id = resource_pool.search(cr,uid,[('user_id','=',resource[no].id)]) - if resource_id: + if resource_id and wktime_cal: # Getting list of leaves for specific resource leaves = leaves_resource(cr,uid,resource_id) resource_objs.append(classobj(str(resource[no].name),(Resource,),{'__doc__':resource[no].name,'__name__':resource[no].name,'vacation':tuple(leaves)})) @@ -184,12 +184,11 @@ class wizard_compute_tasks(wizard.interface): # Creating the project with all the tasks and resources def Project(): - resource = reduce(operator.or_,resource_objs) title = project.name start = date_start - + resource = reduce(operator.or_,resource_objs) # If project has calendar - if wktime_cal or leaves: + if wktime_cal: working_days = wktime_cal vacation = tuple(leaves) diff --git a/addons/project_long_term/wizard/compute_phases_date.py b/addons/project_long_term/wizard/compute_phases_date.py index f713942708b..2d4cf9fd70e 100644 --- a/addons/project_long_term/wizard/compute_phases_date.py +++ b/addons/project_long_term/wizard/compute_phases_date.py @@ -79,13 +79,15 @@ def resource_list(cr,uid,obj): resource_pool = pool.get('resource.resource') resources = obj.resource_ids resource_objs = [] + leaves = [] + calendar_id = obj.project_id.resource_calendar_id for no in range(len(resources)): resource_id = resource_pool.search(cr,uid,[('id','=',resources[no].resource_id.id)]) - if resource_id: + if resource_id and calendar_id: # Getting list of leaves for specific resource leaves = leaves_resource(cr,uid,resource_id) # Creating the faces.Resource object with resource specific efficiency and vacation - resource_objs.append(classobj(str(resources[no].resource_id.name),(Resource,),{'__doc__':resources[no].resource_id.name,'__name__':resources[no].resource_id.name,'efficiency':resources[no].useability/100,'vacation':tuple(leaves)})) + resource_objs.append(classobj(str(resources[no].resource_id.name),(Resource,),{'__doc__':resources[no].resource_id.name,'__name__':resources[no].resource_id.name,'efficiency':resources[no].useability/100,'vacation':tuple(leaves)})) return resource_objs class wizard_compute_phases(wizard.interface): @@ -185,7 +187,7 @@ class wizard_compute_phases(wizard.interface): start = start_date # If project has working calendar else the default one would be considered - if wktime_cal or leaves: + if wktime_cal: working_days = wktime_cal vacation = tuple(leaves) diff --git a/addons/resource/faces/task.py b/addons/resource/faces/task.py index 6fdb28db3f6..e737c333c7c 100755 --- a/addons/resource/faces/task.py +++ b/addons/resource/faces/task.py @@ -1941,7 +1941,7 @@ class Task(object): func.task_func = instrumented # will be used in the gui self._function = instrumented - self.name = name + self.name = func.func_name self.up = parent self.children = [] self._sources = {} # all tasks, I am linked to From 34cbb6821f97cb182cbb39a6e0dce9369a608d39 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Thu, 11 Feb 2010 11:04:49 +0530 Subject: [PATCH 2/2] [FIX]:added missing sequence field in project.project bzr revid: nch@tinyerp.com-20100211053449-d42va557q11gnj5u --- addons/project/project.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 17bafe9aa30..a57f782ef10 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -120,6 +120,7 @@ class project(osv.osv): _columns = { 'complete_name': fields.function(_complete_name, method=True, string="Project Name", type='char', size=250), 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the project without removing it."), + 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."), 'category_id': fields.many2one('account.analytic.account','Analytic Account', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc."), 'priority': fields.integer('Sequence'), 'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team."), @@ -138,10 +139,11 @@ class project(osv.osv): # \n If it is to be reviewed then the state is \'Pending\'.\n When the project is completed the state is set to \'Done\'.'), 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'), } - + _order = "sequence" _defaults = { 'active': lambda *a: True, 'priority': lambda *a: 1, + 'sequence': lambda *a: 10, } def _check_dates(self, cr, uid, ids): leave = self.read(cr, uid, ids[0],['date_start','date'])