do not use resources but users on phases:
- to be consistent with project members and task responsible
- if the user is linked to a resource, it uses the calendar of the resource (holidays for example)
better YML tests
Complete rewrite of the scheduling mechanism:
- Schedule phases:
- write project.user.allocation based on scheduling
- schedule resources based on members on the project
- new constraint: force some users on a phase
- Schedule tasks:
- set user if no user on task
- set start and end date
some useability improvements
We still have to work on better Gantt view but I think the scheduling is
working correctly now.
bzr revid: fp@tinyerp.com-20111025233141-cgctwe8spxhko2gn
119 lines
4.4 KiB
YAML
119 lines
4.4 KiB
YAML
-
|
|
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'
|
|
|