diff --git a/addons/project_long_term/__init__.py b/addons/project_long_term/__init__.py index 8efcc1a0007..6b9b2613f3f 100644 --- a/addons/project_long_term/__init__.py +++ b/addons/project_long_term/__init__.py @@ -22,4 +22,4 @@ import project_long_term import wizard -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_long_term/__openerp__.py b/addons/project_long_term/__openerp__.py index 7bc0e3c9984..dfcddb75b48 100644 --- a/addons/project_long_term/__openerp__.py +++ b/addons/project_long_term/__openerp__.py @@ -18,13 +18,14 @@ # along with this program. If not, see . # ############################################################################## + { - "name" : "Long Term Project Management", + "name": "Long Term Project Management", "version": "1.1", - "author" : "Tiny", - "website" : "http://www.openerp.com", - "category" : "Generic Modules/Projects & Services", - "depends" : ["project", "resource"], + "author": "Tiny", + "website": "http://www.openerp.com", + "category": "Generic Modules/Projects & Services", + "depends": ["project", "resource"], "description": """ Long Term Project management module that tracks planning, scheduling, resources allocation. @@ -36,9 +37,9 @@ - Schedule Tasks: All the tasks which are in draft,pending and open state are scheduled with taking the phase's start date """, - "init_xml" : [], - "demo_xml" : ["project_long_term_demo.xml"], - "test" : [ + "init_xml": [], + "demo_xml": ["project_long_term_demo.xml"], + "test": [ 'test/schedule_project_phases.yml', 'test/schedule_project_tasks.yml', 'test/schedule_phase_tasks.yml' diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index f1c40a4c8ba..4520e798f4e 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -29,7 +29,10 @@ class project_phase(osv.osv): _name = "project.phase" _description = "Project Phase" - def _check_recursion(self, cr, uid, ids, context={}): + def _check_recursion(self, cr, uid, ids, context=None): + if context is None: + context = {} + data_phase = self.browse(cr, uid, ids[0], context=context) prev_ids = data_phase.previous_phase_ids next_ids = data_phase.next_phase_ids @@ -45,7 +48,7 @@ class project_phase(osv.osv): next_ids = [rec.id for rec in next_ids] # iter prev_ids while prev_ids: - cr.execute('select distinct prv_phase_id from project_phase_rel where next_phase_id IN %s',(tuple(prev_ids),)) + cr.execute('SELECT distinct prv_phase_id FROM project_phase_rel WHERE next_phase_id IN %s', (tuple(prev_ids),)) prv_phase_ids = filter(None, map(lambda x: x[0], cr.fetchall())) if data_phase.id in prv_phase_ids: return False @@ -55,7 +58,7 @@ class project_phase(osv.osv): prev_ids = prv_phase_ids # iter next_ids while next_ids: - cr.execute('select distinct next_phase_id from project_phase_rel where prv_phase_id IN %s',(tuple(next_ids),)) + cr.execute('SELECT distinct next_phase_id FROM project_phase_rel WHERE prv_phase_id IN %s', (tuple(next_ids),)) next_phase_ids = filter(None, map(lambda x: x[0], cr.fetchall())) if data_phase.id in next_phase_ids: return False @@ -65,19 +68,19 @@ class project_phase(osv.osv): next_ids = next_phase_ids return True - def _check_dates(self, cr, uid, ids, context={}): + def _check_dates(self, cr, uid, ids, context=None): for phase in self.read(cr, uid, ids, ['date_start', 'date_end'], context=context): if phase['date_start'] and phase['date_end'] and phase['date_start'] > phase['date_end']: return False return True - def _check_constraint_start(self, cr, uid, ids, context={}): + def _check_constraint_start(self, cr, uid, ids, context=None): phase = self.read(cr, uid, ids[0], ['date_start', 'constraint_date_start'], context=context) if phase['date_start'] and phase['constraint_date_start'] and phase['date_start'] < phase['constraint_date_start']: return False return True - def _check_constraint_end(self, cr, uid, ids, context={}): + def _check_constraint_end(self, cr, uid, ids, context=None): phase = self.read(cr, uid, ids[0], ['date_end', 'constraint_date_end'], context=context) if phase['date_end'] and phase['constraint_date_end'] and phase['date_end'] > phase['constraint_date_end']: return False @@ -97,7 +100,7 @@ class project_phase(osv.osv): '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'), + 'responsible_id': fields.many2one('res.users', 'Responsible'), '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\'.') @@ -116,7 +119,7 @@ class project_phase(osv.osv): #(_check_constraint_end, 'Phase must end-before constraint end Date.', ['date_end', 'constraint_date_end']), ] - def onchange_project(self, cr, uid, ids, project, context={}): + def onchange_project(self, cr, uid, ids, project, context=None): result = {} project_obj = self.pool.get('project.project') if project: @@ -126,7 +129,9 @@ class project_phase(osv.osv): return {'value': result} return {'value': {'date_start': []}} - def _check_date_start(self, cr, uid, phase, date_end, context={}): + def _check_date_start(self, cr, uid, phase, date_end, context=None): + if context is None: + context = {} """ Check And Compute date_end of phase if change in date_start < older time. """ @@ -147,7 +152,9 @@ class project_phase(osv.osv): 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) - def _check_date_end(self, cr, uid, phase, date_start, context={}): + def _check_date_end(self, cr, uid, phase, date_start, context=None): + if context is None: + context = {} """ Check And Compute date_end of phase if change in date_end > older time. """ @@ -168,11 +175,11 @@ class project_phase(osv.osv): 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) - def write(self, cr, uid, ids, vals, context={}): + def write(self, cr, uid, ids, vals, context=None): resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') uom_obj = self.pool.get('product.uom') - if not context: + if context is None: context = {} if context.get('scheduler',False): return super(project_phase, self).write(cr, uid, ids, vals, context=context) @@ -191,7 +198,7 @@ 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 %H:%M:%S') 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') @@ -214,7 +221,7 @@ class project_phase(osv.osv): self.write(cr, uid, ids, {'state': 'open'}) return True - def set_pending(self, cr, uid, ids,*args): + def set_pending(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state': 'pending'}) return True diff --git a/addons/project_long_term/project_long_term_data.xml b/addons/project_long_term/project_long_term_data.xml index 32d041544cc..8da591f1337 100644 --- a/addons/project_long_term/project_long_term_data.xml +++ b/addons/project_long_term/project_long_term_data.xml @@ -1,6 +1,7 @@ + Project @@ -10,5 +11,6 @@ Project task project.task + diff --git a/addons/project_long_term/project_long_term_demo.xml b/addons/project_long_term/project_long_term_demo.xml index 657658eba46..b688e45876a 100644 --- a/addons/project_long_term/project_long_term_demo.xml +++ b/addons/project_long_term/project_long_term_demo.xml @@ -8,151 +8,151 @@ en_US Demo User1 - + Mr Demo - - + + demo1 demo1 - + en_US Manager1 - + - - + + manager1 manager1 - + en_US Manager2 - + - - + + manager2 manager2 - + en_US user1 - + - - + + user1 USER1 - + en_US user2 - + - - + + user2 user2 - + en_US user_finance - + - - + + user_finance user_finance - + en_US user_design1 - + - - + + user_design1 user_design1 - + en_US user_design2 - + - - + + user_design2 user_design2 - + en_US user_developer1 - + - - + + user_developer1 user_developer1 - + en_US user_developer2 - + - - + + user_developer2 user_developer1 - + @@ -161,43 +161,43 @@ user_tester1 - - + + user_tester1 user_tester1 - + en_US user_tester2 - + - - + + user_tester2 user_tester2 - + en_US user_analyst - + - - + + user_analyst user_analyst - + @@ -255,17 +255,17 @@ open normal Develop an OpenERP Website. - + 2010-04-30 - + OpenERP Website Development - + Information Gathering and Understanding @@ -280,7 +280,7 @@ - + Planning @@ -295,7 +295,7 @@ - + Web Design @@ -310,7 +310,7 @@ - + Development, Integration and Testing @@ -325,7 +325,7 @@ - + Website Deployment @@ -405,8 +405,8 @@ 2 draft - - + + Prepare Requirements Document 2010-03-08 @@ -424,8 +424,8 @@ 2 draft - - + + Define Website Goals, Purposes and Target Audience 2010-03-04 @@ -443,8 +443,8 @@ 2 draft - - + + Use Cases 2010-03-10 @@ -462,8 +462,8 @@ 2 draft - - + + Budget Planning 2010-03-31 @@ -481,8 +481,8 @@ 2 draft - - + + Quality Planning 2010-03-31 @@ -500,8 +500,8 @@ 2 draft - - + + Risk Management Planning 2010-03-31 @@ -519,8 +519,8 @@ 2 draft - - + + Create Project Schedules 2010-03-31 @@ -538,8 +538,8 @@ 2 draft - - + + Dataflow Design 2010-04-02 @@ -557,8 +557,8 @@ 2 draft - - + + User Interface Design 2010-04-10 @@ -576,8 +576,8 @@ 2 draft - - + + Task Level WBS 2010-04-07 @@ -595,8 +595,8 @@ 2 draft - - + + Modular Programming 2010-04-22 @@ -613,8 +613,8 @@ 2 draft - - + + Integrate Modules 2010-04-24 @@ -631,8 +631,8 @@ 2 draft - - + + Unit Testing 2010-04-24 @@ -649,8 +649,8 @@ 2 draft - - + + Regression Test 2010-04-24 @@ -667,8 +667,8 @@ 2 draft - - + + Documentation 2010-04-24 @@ -685,8 +685,8 @@ 2 draft - - + + Performance Tuning 2010-04-24 @@ -703,8 +703,8 @@ 2 draft - - + + Deploy Website 2010-04-26 @@ -721,8 +721,8 @@ 2 draft - - + + Presentation 2010-04-28 @@ -739,8 +739,8 @@ 2 draft - - + + Deployment 2010-04-28 @@ -758,8 +758,8 @@ 2 draft - - + + Presentation 2010-04-29 @@ -777,8 +777,8 @@ 2 draft - - + + Modules Integration 2010-04-24 @@ -796,8 +796,8 @@ 2 draft - - + + Unit Testing 2010-04-24 @@ -815,8 +815,8 @@ 2 draft - - + + Modular Testing 2010-04-24 @@ -834,8 +834,8 @@ 2 draft - - + + Documentation 2010-04-28 @@ -853,8 +853,8 @@ 2 draft - - + + Performance Tuning 2010-04-27 @@ -873,8 +873,8 @@ 2 draft - - + + Modular Programming 2010-04-22 @@ -882,5 +882,6 @@ + diff --git a/addons/project_long_term/project_long_term_report.xml b/addons/project_long_term/project_long_term_report.xml index 3bbbce1874c..d8fe2a4fa6e 100644 --- a/addons/project_long_term/project_long_term_report.xml +++ b/addons/project_long_term/project_long_term_report.xml @@ -1,7 +1,9 @@ + + diff --git a/addons/project_long_term/project_long_term_wizard.xml b/addons/project_long_term/project_long_term_wizard.xml index ea43762653c..7f3668c6b1a 100644 --- a/addons/project_long_term/project_long_term_wizard.xml +++ b/addons/project_long_term/project_long_term_wizard.xml @@ -6,7 +6,7 @@ - + -