From 466c37fe3ead791a009d999c60401ca46aa34148 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Wed, 14 Jul 2010 04:51:26 +0530 Subject: [IMP] project_long_term: gantt view of resource allocation bzr revid: qdp-launchpad@tinyerp.com-20100713232126-kkryzm2ku8pqzthn --- addons/project_long_term/project_long_term.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index f76ab413e23..f1b4ab804c9 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -247,6 +247,8 @@ class project_resource_allocation(osv.osv): _columns = { 'resource_id': fields.many2one('resource.resource', 'Resource', required=True), 'phase_id': fields.many2one('project.phase', 'Project Phase', required=True), + 'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'), + 'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'), 'useability': fields.float('Usability', help="Usability of this resource for this project phase in percentage (=50%)"), } _defaults = { -- cgit v1.2.3 From c4afa3c7715ea1df11a663d02ed0914b0fa4b3cf Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Wed, 14 Jul 2010 14:34:50 +0530 Subject: [IMP] project_long_term: gantt view + small bugfix bzr revid: qdp-launchpad@tinyerp.com-20100714090450-0la05jgw3pf59e5c --- addons/project_long_term/project_long_term.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index f1b4ab804c9..e1233bc413e 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -93,8 +93,8 @@ class project_phase(osv.osv): _columns = { 'name': fields.char("Name", size=64, required=True), - 'date_start': fields.datetime('Start Date', help="Starting Date of the phase"), - 'date_end': fields.datetime('End Date', help="Ending Date of the phase"), + 'date_start': fields.date('Start Date', help="Starting Date of the phase"), + 'date_end': fields.date('End Date', help="Ending Date of the phase"), 'constraint_date_start': fields.datetime('Start Date', help='force the phase to start after this date'), 'constraint_date_end': fields.datetime('End Date', help='force the phase to finish before this date'), 'project_id': fields.many2one('project.project', 'Project', required=True), @@ -114,7 +114,7 @@ class project_phase(osv.osv): 'responsible_id': lambda obj,cr,uid,context: uid, 'state': 'draft', 'sequence': 10, - 'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', 'day')], context=c)[0] + 'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Day'))], context=c)[0] } _order = "name" _constraints = [ -- cgit v1.2.3 From f5707955cdf4beee85a0b02e96e56a4746b9504e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Fri, 23 Jul 2010 13:08:54 -0300 Subject: [FIX] project_long_term: deleting a phase should delete its affected resources! bzr revid: rvalyi@gmail.com-20100723160854-jdjopucvsl4x2af2 --- addons/project_long_term/project_long_term.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 0ecdcc69a2e..56e2ff9b3d8 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -245,7 +245,7 @@ class project_resource_allocation(osv.osv): _description = 'Project Resource Allocation' _rec_name = 'resource_id' _columns = { - 'resource_id': fields.many2one('resource.resource', 'Resource', required=True), + 'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True), 'phase_id': fields.many2one('project.phase', 'Project Phase', required=True), 'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'), 'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'), -- cgit v1.2.3 From 717c7c5b11fb0a4bd6821abc8f774bf6f4d5ceb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 25 Jul 2010 12:55:48 -0300 Subject: [FIX] project_long_term: it's phase_id that should be ondelete='cascade'; fixed write if only one id provided as it is usually permitted bzr revid: rvalyi@gmail.com-20100725155548-fss28s73p0gvxjrj --- addons/project_long_term/project_long_term.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 56e2ff9b3d8..fc1fea91311 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -190,6 +190,8 @@ class project_phase(osv.osv): return super(project_phase, self).write(cr, uid, ids, vals, context=context) # Consider calendar and efficiency if the phase is performed by a resource # otherwise consider the project's working calendar + if type(ids) == int: + ids = [ids] phase = self.browse(cr, uid, ids[0], context=context) calendar_id = phase.project_id.resource_calendar_id and phase.project_id.resource_calendar_id.id or False resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)],context=context) @@ -245,8 +247,8 @@ class project_resource_allocation(osv.osv): _description = 'Project Resource Allocation' _rec_name = 'resource_id' _columns = { - 'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True), - 'phase_id': fields.many2one('project.phase', 'Project Phase', required=True), + 'resource_id': fields.many2one('resource.resource', 'Resource', required=True), + 'phase_id': fields.many2one('project.phase', 'Project Phase', ondelete='cascade', required=True), 'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'), 'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'), 'useability': fields.float('Usability', help="Usability of this resource for this project phase in percentage (=50%)"), -- cgit v1.2.3 From 3bc25fb07ef8aa959d2c7df0b9515e6a3147c0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 25 Jul 2010 13:58:26 -0300 Subject: [REF] clean up before merge (clean double work diffs) bzr revid: rvalyi@gmail.com-20100725165826-etg68lktjnt9ih5l --- addons/project_long_term/project_long_term.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index fc1fea91311..9371232745b 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -252,8 +252,6 @@ class project_resource_allocation(osv.osv): 'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'), 'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'), 'useability': fields.float('Usability', help="Usability of this resource for this project phase in percentage (=50%)"), - 'date_start': fields.related('phase_id', 'date_start', type='datetime', string='Start Date'), - 'date_end': fields.related('phase_id', 'date_end', type='datetime', string='End Date'), } _defaults = { 'useability': 100, -- cgit v1.2.3 From 9bd6693f6d7c870d910e27b75f99397815b0ef73 Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Thu, 29 Jul 2010 11:01:04 +0530 Subject: [IMP]: imp in project, project_log_term - changed type of all the dates in project phase from datetime to date - improved send mail wizard on closing a task based on projects warn_customer, war_manager fields improved yaml and demo data fields set to readonly when project, phases or tasks in done state bzr revid: pap@tinyerp.co.in-20100729053104-vx94tzk051896frz --- addons/project_long_term/project_long_term.py | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index e1233bc413e..03b8ae8edc8 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -93,19 +93,19 @@ class project_phase(osv.osv): _columns = { 'name': fields.char("Name", size=64, required=True), - 'date_start': fields.date('Start Date', help="Starting Date of the phase"), - 'date_end': fields.date('End Date', help="Ending Date of the phase"), - 'constraint_date_start': fields.datetime('Start Date', help='force the phase to start after this date'), - 'constraint_date_end': fields.datetime('End Date', help='force the phase to finish before this date'), + 'date_start': fields.date('Start Date', help="Starting Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'date_end': fields.date('End Date', help="Ending Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'constraint_date_start': fields.date('Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'constraint_date_end': fields.date('End Date', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'project_id': fields.many2one('project.project', 'Project', required=True), - 'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases'), - 'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases'), + 'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases', states={'cancelled':[('readonly',True)]}), + 'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases', states={'cancelled':[('readonly',True)]}), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of phases."), - 'duration': fields.float('Duration', required=True, help="By default in days"), - 'product_uom': fields.many2one('product.uom', 'Duration UoM', required=True, help="UoM (Unit of Measure) is the unit of measurement for Duration"), - 'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks"), - 'resource_ids': fields.one2many('project.resource.allocation', 'phase_id', "Project Resources"), - 'responsible_id': fields.many2one('res.users', 'Responsible'), + 'duration': fields.float('Duration', required=True, help="By default in days", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'product_uom': fields.many2one('product.uom', 'Duration UoM', required=True, help="UoM (Unit of Measure) is the unit of measurement for Duration", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'resource_ids': fields.one2many('project.resource.allocation', 'phase_id', "Project Resources",states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'responsible_id': fields.many2one('res.users', 'Responsible', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True, help='If the phase is created the state \'Draft\'.\n If the phase is started, the state becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' state.\ \n If the phase is over, the states is set to \'Done\'.') @@ -130,7 +130,7 @@ class project_phase(osv.osv): if project: project_id = project_obj.browse(cr, uid, project, context=context) if project_id.date_start: - result['date_start'] = mx.DateTime.strptime(project_id.date_start, "%Y-%m-%d").strftime('%Y-%m-%d %H:%M:%S') + result['date_start'] = mx.DateTime.strptime(project_id.date_start, "%Y-%m-%d").strftime('%Y-%m-%d') return {'value': result} return {'value': {'date_start': []}} @@ -147,15 +147,15 @@ class project_phase(osv.osv): resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)]) if resource_id: # cal_id = resource_obj.browse(cr, uid, resource_id[0], context=context).calendar_id.id - res = resource_obj.read(cr, uid, resource_id[0], ['calendar_id'], context=context)[0] + res = resource_obj.read(cr, uid, resource_id, ['calendar_id'], context=context)[0] cal_id = res.get('calendar_id', False) and res.get('calendar_id')[0] or False if cal_id: calendar_id = cal_id default_uom_id = self._get_default_uom_id(cr, uid) avg_hours = uom_obj._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id) work_times = cal_obj.interval_min_get(cr, uid, calendar_id, date_end, avg_hours or 0.0, resource_id and resource_id[0] or False) - dt_start = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S') - self.write(cr, uid, [phase.id], {'date_start': dt_start, 'date_end': date_end.strftime('%Y-%m-%d %H:%M:%S')}, context=context) + dt_start = work_times[0][0].strftime('%Y-%m-%d') + self.write(cr, uid, [phase.id], {'date_start': dt_start, 'date_end': date_end.strftime('%Y-%m-%d')}, context=context) def _check_date_end(self, cr, uid, phase, date_start, context=None): if context is None: @@ -170,15 +170,15 @@ class project_phase(osv.osv): resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)], context=context) if resource_id: # cal_id = resource_obj.browse(cr, uid, resource_id[0], context=context).calendar_id.id - res = resource_obj.read(cr, uid, resource_id[0], ['calendar_id'], context=context)[0] + res = resource_obj.read(cr, uid, resource_id, ['calendar_id'], context=context)[0] cal_id = res.get('calendar_id', False) and res.get('calendar_id')[0] or False if cal_id: calendar_id = cal_id default_uom_id = self._get_default_uom_id(cr, uid) avg_hours = uom_obj._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id) work_times = cal_obj.interval_get(cr, uid, calendar_id, date_start, avg_hours or 0.0, resource_id and resource_id[0] or False) - dt_end = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S') - self.write(cr, uid, [phase.id], {'date_start': date_start.strftime('%Y-%m-%d %H:%M:%S'), 'date_end': dt_end}, context=context) + dt_end = work_times[-1][1].strftime('%Y-%m-%d') + self.write(cr, uid, [phase.id], {'date_start': date_start.strftime('%Y-%m-%d'), 'date_end': dt_end}, context=context) def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') @@ -203,17 +203,17 @@ class project_phase(osv.osv): # Change the date_start and date_end # for previous and next phases respectively based on valid condition if vals.get('date_start', False) and vals['date_start'] < phase.date_start: - dt_start = mx.DateTime.strptime(vals['date_start'], '%Y-%m-%d %H:%M:%S') + dt_start = mx.DateTime.strptime(vals['date_start'], '%Y-%m-%d') work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, dt_start, avg_hours or 0.0, resource_id and resource_id[0] or False) if work_times: - vals['date_end'] = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S') + vals['date_end'] = work_times[-1][1].strftime('%Y-%m-%d') for prv_phase in phase.previous_phase_ids: self._check_date_start(cr, uid, prv_phase, dt_start, context=context) if vals.get('date_end', False) and vals['date_end'] > phase.date_end: - dt_end = mx.DateTime.strptime(vals['date_end'],'%Y-%m-%d %H:%M:%S') + dt_end = mx.DateTime.strptime(vals['date_end'],'%Y-%m-%d') work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, dt_end, avg_hours or 0.0, resource_id and resource_id[0] or False) if work_times: - vals['date_start'] = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S') + vals['date_start'] = work_times[0][0].strftime('%Y-%m-%d') for next_phase in phase.next_phase_ids: self._check_date_end(cr, uid, next_phase, dt_end, context=context) return super(project_phase, self).write(cr, uid, ids, vals, context=context) @@ -261,7 +261,7 @@ class project(osv.osv): _inherit = "project.project" _columns = { 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"), - 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"), + 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ), } project() -- cgit v1.2.3 From ac56c74c8cbb3293ac937849c7f6b905b69fbd30 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 30 Jul 2010 14:35:21 +0200 Subject: [FIX] project_long_term: Use the isinstance built-in function instead of type bzr revid: stephane@openerp.com-20100730123521-79aal4640kzetw57 --- addons/project_long_term/project_long_term.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index e87512d0c75..f4ae126ee67 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -190,7 +190,7 @@ class project_phase(osv.osv): return super(project_phase, self).write(cr, uid, ids, vals, context=context) # Consider calendar and efficiency if the phase is performed by a resource # otherwise consider the project's working calendar - if type(ids) == int: + if isinstance(ids, (int, long)): ids = [ids] phase = self.browse(cr, uid, ids[0], context=context) calendar_id = phase.project_id.resource_calendar_id and phase.project_id.resource_calendar_id.id or False -- cgit v1.2.3