diff options
| author | Atik Agewan (OpenERP) <aag@tinyerp.com> | 2011-09-27 18:55:08 +0530 |
|---|---|---|
| committer | Atik Agewan (OpenERP) <aag@tinyerp.com> | 2011-09-27 18:55:08 +0530 |
| commit | f89189a59b1e26b25de30bc2efe8f755680fc8a3 (patch) | |
| tree | 234bf3cf944fb37ba499582101bf520e1b88e246 /addons/project_long_term | |
| parent | 5385f7514406c4d457a0ca9b8f9327052c37d223 (diff) | |
| parent | 0bee9676d5d9ffafc6e8f8bf47c976ba5e402af5 (diff) | |
[MERGE]: Merge with lp:openobject-addons
bzr revid: aag@tinyerp.com-20110927132508-949u6416aj2294bt
Diffstat (limited to 'addons/project_long_term')
5 files changed, 51 insertions, 115 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 6c5ef7890bf..7cd6697b67a 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -117,7 +117,7 @@ class project_phase(osv.osv): '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, + 'state': fields.selection([('draft', 'New'), ('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\'.'), 'total_hours': fields.function(_compute, string='Total Hours'), diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml index 8d976517a34..49b306ebfd5 100644 --- a/addons/project_long_term/project_long_term_view.xml +++ b/addons/project_long_term/project_long_term_view.xml @@ -74,13 +74,13 @@ <field name="type">search</field> <field name="arch" type="xml"> <search string="Resources Allocation"> - <group colspan="4" col="20"> + <group> <field name="resource_id"/> <field name="phase_id"/> <field name="project_id"/> </group> <newline/> - <group expand="0" string="Group By..." colspan="4" col="20"> + <group expand="0" string="Group By..."> <filter name="resource" string="Resource" icon="terp-personal" domain="[]" context="{'group_by':'resource_id'}"/> <separator orientation="vertical"/> <filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/> @@ -140,7 +140,7 @@ </field> <separator string="" colspan="4"/> <group col="12" colspan="4"> - <field name="state" select="1"/> + <field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}' select="1"/> <button string="Cancel" name="set_cancel" states="draft,open,pending" icon="gtk-cancel"/> <button string="Draft" name="set_draft" states="open" icon="gtk-indent"/> <button string="Pending" name="set_pending" states="open" icon="gtk-media-pause"/> @@ -266,8 +266,8 @@ <field name="type">search</field> <field name="arch" type="xml"> <search string="Project Phases"> - <group colspan="4" col="20"> - <filter string="Current" domain="[('state','in',('open','draft','pending'))]" name="current" help="Draft, In Progress and Pending Phases" icon="terp-check"/> + <group> + <filter string="New" domain="[('state','=','draft')]" name="current" help="New Phases" icon="terp-check"/> <filter string="In Progress" name="Progress" domain="[('state','=','open')]" help="In Progress Phases" icon="terp-camera_test"/> <filter string="Pending" domain="[('state','=','pending')]" help="Pending Phases" icon="terp-gtk-media-pause"/> <separator orientation="vertical"/> @@ -280,7 +280,7 @@ <field name="date_end"/> </group> <newline/> - <group expand="0" string="Group By..." colspan="4" col="20" groups="base.group_extended"> + <group expand="0" string="Group By..." groups="base.group_extended"> <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'responsible_id'}"/> <separator orientation="vertical"/> <filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}" name="project"/> diff --git a/addons/project_long_term/test/phase_constraint.yml b/addons/project_long_term/test/phase_constraint.yml index cf6bfa844a6..ad1a3db095e 100644 --- a/addons/project_long_term/test/phase_constraint.yml +++ b/addons/project_long_term/test/phase_constraint.yml @@ -1,133 +1,66 @@ - - I have a project 'Develop yaml Project Module'. + Given that I have a project 'Test Phases'. - !record {model: project.project, id: project_project_developyamlproject0}: name: "Develop Yaml Project Module" date_start: !eval time.strftime('%Y-%m-%d') + resource_calendar_id: resource.timesheet_group1 - - I have set Working Time from Monday to Friday from 9am to 17pm. -- - !record {model: resource.calendar, id: resource_calendar_hoursweeks0}: - name: "from Monday to Friday, from 9am to 17pm" - -- - I have set Day1 Working Time for Monday to Friday from 9am to 17pm working hour -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day1" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "0" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day2 Working Time for Monday to Friday from 9am to 17pm working hour -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day2" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "1" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day3 Working Time for Monday to Friday from 9am to 17pm working hour -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day3" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "2" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day4 Working Time for Monday to Friday from 9am to 17pm working hour -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day4" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "3" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day5 Working Time for Monday to Friday from 9am to 17pm working hour -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day5" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "4" - calendar_id : resource_calendar_hoursweeks0 - - -- - Now Set working period to Project 'Develop yaml Project Module' -- - !python {model: project.project}: | - self.write(cr, uid, [ref("project_project_developyamlproject0")], {'resource_calendar_id': ref("resource_calendar_hoursweeks0")}) - - -- - Creating 3 consecutive 5-days phases. - For that Creating a Analyst Human resource to analyst Project Yaml. + And I create three human ressources to work on this project, an analyst. - !record {model: resource.resource, id: resource_resource_analyst1}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: Analyst resource_type: user time_efficiency: 1.0 user_id: base.user_admin - - - Creating Developer Human resource who develop Yaml + I define a developer HR. - !record {model: resource.resource, id: resource_resource_develop0}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: Developer resource_type: user time_efficiency: 1.0 user_id: base.user_admin - - Creating a Tester Human resource for testing Yaml + I define a tester HR. - !record {model: resource.resource, id: resource_resource_tester1}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: tester resource_type: user time_efficiency: 1.0 user_id: base.user_admin - - - Create 3 a project phase and NO one depends on other one. - so,they should start on the same day. - Creating First 'Analysis Flow for Yaml' Project Phase. + Then I create three phases for my projects; Analysis, Development, Testing. +- + The first phase is 'Analysis' and has a duration of 6 days. - !record {model: project.phase, id: project_phase_analysisflowforyaml0}: date_start: !eval time.strftime('%Y-%m-%d') duration: 6.0 - name: "Analysis Flow for Yaml" + name: "Analysis" product_uom: product.uom_day project_id: project_project_developyamlproject0 responsible_id: project.res_users_analyst state: draft - - I update the Constrain Date Start adn Date End for phase Analysis Flow for Yaml + I update the constrain and the analysis phase to not start before 4 days. - !python {model : project.phase }: | + pass import datetime from dateutil.relativedelta import * - start = datetime.date.today() - relativedelta(days=2) - end = datetime.date.today() + relativedelta(days=6) - self.write(cr,uid, [(ref("project_phase_analysisflowforyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) - + start = datetime.date.today() + relativedelta(days=4) + self.write(cr,uid, [(ref("project_phase_analysisflowforyaml0"))], {'constraint_date_start': start}) - - Create project phase 'Develop yaml' with constraint date. + The second phase is 'Development' and depend on the 'Analysis', with a duration of 6 days. - !record {model: project.phase, id: project_phase_developyaml0}: duration: 6.0 - name: Develop Yaml + name: Development product_uom: product.uom_day project_id: project_project_developyamlproject0 previous_phase_ids: @@ -137,43 +70,48 @@ I update the Constrain Date Start adn Date End for phase Develop yaml - !python {model : project.phase }: | + pass import datetime - from dateutil.relativedelta import * - start = datetime.date.today() - relativedelta(days=5) - end = datetime.date.today() + relativedelta(days=10) - self.write(cr,uid, [(ref("project_phase_developyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) + #from dateutil.relativedelta import * + #start = datetime.date.today() - relativedelta(days=5) + #end = datetime.date.today() + relativedelta(days=10) + #self.write(cr,uid, [(ref("project_phase_developyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) - - Create project phase 'Test Yaml' + The third phase is 'Testing' and depend on the 'Develop' phase, with a duration of 6 days. - !record {model: project.phase, id: project_phase_testyaml0}: duration: 6.0 - name: Testing Yaml + name: Testing product_uom: product.uom_day project_id: project_project_developyamlproject0 previous_phase_ids: - project_phase_developyaml0 - constraint_date_start : - constraint_date_end : - - Compute Schedule of phases For One project + Then I launch the scheduler to compute starting and ending phases on all phases of this project. - !record {model: project.compute.phases, id: project_compute_phases_0}: project_id: project_project_developyamlproject0 target_project: one - -- - Schedule project phases using "Compute Phase Scheduling" - !python {model: project.project}: | self.schedule_phases(cr, uid, [ref("project_project_developyamlproject0")]) - - - After scheduling,check that - Phase "Analysis Flow for Yaml" and "Test Yaml" Phase should start on the project start date while "Develop yaml" Phase should respect the constraint. + After scheduling, I check the starting date and ending date on the phases are correct. - - !python {model: project.project}: | - proj=self.browse(cr, uid, [ref("project_project_developyamlproject0")])[0] - for phase in proj.phase_ids: - for phase1 in proj.phase_ids: - if phase1.id != phase.id and phase.constraint_date_start == phase1.date_start: - raise AssertionError("Phases not scheduled") + !python {model: project.phase}: | + import datetime + from dateutil.relativedelta import * + minstart = (datetime.date.today() + relativedelta(days=4)).strftime('%Y-%m-%d') + minend = (datetime.date.today() + relativedelta(days=11)).strftime('%Y-%m-%d') + + phase1=self.browse(cr, uid, ref('project_phase_analysisflowforyaml0')) + assert phase1.date_start>=minstart, 'Error, the Analysis phase '+phase1.date_start+' should start after '+str(minstart) + assert phase1.date_end>=minend, 'Error, the Analysis phase should end after '+str(minend) + + phase2=self.browse(cr, uid, ref('project_phase_developyaml0')) + assert phase2.date_start>=phase1.date_end, 'Error, the phase Development should start after the end of the Analysis phase' + + phase3=self.browse(cr, uid, ref('project_phase_testyaml0')) + assert phase3.date_start>=phase2.date_end, 'Error, the phase Testing should start after the end of the Development phase' + assert phase3.date_start<phase3.date_end, 'Error, the phase Testing should start before ending' + diff --git a/addons/project_long_term/wizard/project_compute_phases_view.xml b/addons/project_long_term/wizard/project_compute_phases_view.xml index 9d5754af09c..69b7d94eabd 100644 --- a/addons/project_long_term/wizard/project_compute_phases_view.xml +++ b/addons/project_long_term/wizard/project_compute_phases_view.xml @@ -31,7 +31,6 @@ <field name="view_type">form</field> <field name="view_mode">form</field> <field name="view_id" ref="view_project_compute_phases_select"/> - <field name="context">{'record_id': active_id}</field> <field name="target">new</field> <field name="help">To schedule phases of all or a specified project. It then open a gantt view. </field> diff --git a/addons/project_long_term/wizard/project_compute_tasks_view.xml b/addons/project_long_term/wizard/project_compute_tasks_view.xml index e6540fafff9..e679110acdc 100644 --- a/addons/project_long_term/wizard/project_compute_tasks_view.xml +++ b/addons/project_long_term/wizard/project_compute_tasks_view.xml @@ -30,7 +30,6 @@ <field name="view_type">form</field> <field name="view_mode">form</field> <field name="view_id" ref="view_project_compute_tasks"/> - <field name="context">{'record_id' : active_id}</field> <field name="target">new</field> </record> |
