summaryrefslogtreecommitdiff
path: root/addons/project_long_term/test/phase_constraint.yml
diff options
context:
space:
mode:
Diffstat (limited to 'addons/project_long_term/test/phase_constraint.yml')
-rw-r--r--addons/project_long_term/test/phase_constraint.yml118
1 files changed, 0 insertions, 118 deletions
diff --git a/addons/project_long_term/test/phase_constraint.yml b/addons/project_long_term/test/phase_constraint.yml
deleted file mode 100644
index f4fa09e6e38..00000000000
--- a/addons/project_long_term/test/phase_constraint.yml
+++ /dev/null
@@ -1,118 +0,0 @@
--
- 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
- members:
- - base.user_admin
--
- And I create three human ressources to work on this project, an analyst.
--
- !record {model: resource.resource, id: resource_resource_analyst1}:
- calendar_id: resource.timesheet_group1
- name: Analyst
- resource_type: user
- time_efficiency: 1.0
- user_id: base.user_admin
--
- I define a developer HR.
--
- !record {model: resource.resource, id: resource_resource_develop0}:
- calendar_id: resource.timesheet_group1
- name: Developer
- resource_type: user
- time_efficiency: 1.0
- user_id: base.user_admin
--
- I define a tester HR.
--
- !record {model: resource.resource, id: resource_resource_tester1}:
- calendar_id: resource.timesheet_group1
- name: tester
- resource_type: user
- time_efficiency: 1.0
- user_id: base.user_admin
--
- 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"
- product_uom: product.uom_day
- project_id: project_project_developyamlproject0
- state: draft
-
--
- 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=4)
- self.write(cr,uid, [(ref("project_phase_analysisflowforyaml0"))], {'constraint_date_start': start})
--
- 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: Development
- product_uom: product.uom_day
- project_id: project_project_developyamlproject0
- previous_phase_ids:
- - project_phase_analysisflowforyaml0
-
--
- 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})
--
- 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
- product_uom: product.uom_day
- project_id: project_project_developyamlproject0
- previous_phase_ids:
- - project_phase_developyaml0
--
- 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
--
- !python {model: project.project}: |
- self.schedule_phases(cr, uid, [ref("project_project_developyamlproject0")])
--
- After scheduling, I check the starting date and ending date on the phases are correct.
--
- !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'
-