-
  Create a project 'World Bank's Project'
-
  !record {model: project.project, id: project_project_worldbanksproject0}:
    name: "World Bank's Project"
    priority: 4
    members:
      - project.res_users_analyst
      - project.res_users_project_manager
      - project.res_users_technical_leader
      - project.res_users_developer
      - project.res_users_designer
      - project.res_users_tester

-
  Create a project phase 'Defining Client's Basic Idea of Project'
-
  !record {model: project.phase, id: project_phase_definingclientsbasicideaofproject0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 15.0
    name: "Defining Client's Basic Idea of Project"
    product_uom: product.uom_day
    project_id: project_project_worldbanksproject0

-
  Create project phase 'Establishing Project Feasibility'
-
  !record {model: project.phase, id: project_phase_establishingprojectfeasibility0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 30.0
    name: Establishing Project Feasibility
    product_uom: product.uom_day
    project_id: project_project_worldbanksproject0

-
 Resource1
-
  !record {model: project.resource.allocation, id: res_phase1}:
    resource_id: project_long_term.resource_project_manager
    phase_id: project_phase_definingclientsbasicideaofproject0

-
 Resource2
-
  !record {model: project.resource.allocation, id: res_phase2}:
    resource_id: project_long_term.resource_analyst
    phase_id: project_phase_definingclientsbasicideaofproject0

-
 Resource3
-
  !record {model: project.resource.allocation, id: res_phase3}:
    resource_id: project_long_term.resource_technical_leader
    phase_id: project_phase_definingclientsbasicideaofproject0

-
  Create the phase task 'Develop GUI for Server Configuration'
-
  !record {model: project.task, id: project_task_t0}:
    name: Develop GUI for Server Configuration
    planned_hours: 20.0
    state: draft
    phase_id:  project_phase_definingclientsbasicideaofproject0
    project_id: project_project_worldbanksproject0

-
  Create the phase task 'Develop GUI for Modules Configuration'
-
  !record {model: project.task, id: project_task_t1}:
    name: Develop GUI for Modules Configuration
    planned_hours: 25.0
    remaining_hours: 25.0
    state: draft
    phase_id:  project_phase_definingclientsbasicideaofproject0
    project_id: project_project_worldbanksproject0

-
  Create project phase 'Preparation of Engineering Designs'
-
  !record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 100.0
    name: Preparation of Engineering Designs
    product_uom: product.uom_hour
    project_id: project_project_worldbanksproject0

-
 Resource4
-
  !record {model: project.resource.allocation, id: res_phase4}:
    resource_id: project_long_term.resource_developer
    phase_id: project_phase_preparationofengineeringdesigns0

-
 Resource5
-
  !record {model: project.resource.allocation, id: res_phase5}:
    resource_id: project_long_term.resource_designer
    phase_id: project_phase_preparationofengineeringdesigns0

-
  Create the phase task 'Develop GUI for Client Configuration'
-
  !record {model: project.task, id: project_task_t2}:
    name: Develop GUI for Server Configuration
    planned_hours: 20.0
    remaining_hours: 20.0
    state: draft
    phase_id:  project_phase_preparationofengineeringdesigns0
    project_id: project_project_worldbanksproject0

-
  Create the phase task 'Develop GUI for Client Module Configuration'
-
  !record {model: project.task, id: project_task_t3}:
    name: Develop GUI for Modules Configuration
    planned_hours: 25.0
    remaining_hours: 25.0
    state: draft
    phase_id:  project_phase_preparationofengineeringdesigns0
    project_id: project_project_worldbanksproject0


-
  Create project phase 'Procurement of Works and Goods'
-
  !record {model: project.phase, id: project_phase_procurementofworksandgoods0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 24.0
    name: Procurement of Works and Goods
    product_uom: product.uom_hour
    project_id: project_project_worldbanksproject0

-
  Create project phase 'Project Construction'
-
  !record {model: project.phase, id: project_phase_projectconstruction0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 4320.0
    name: Project Construction
    product_uom: product.uom_hour
    project_id: project_project_worldbanksproject0


-
  Create project phase 'Project Completion'
-
  !record {model: project.phase, id: project_phase_projectcompletion0}:
    date_start: !eval time.strftime('%Y-%m-%d')
    duration: 240.0
    name: Project Completion
    product_uom: product.uom_hour
    project_id: project_project_worldbanksproject0

-
  Set previous phase for phase 'Establishing Project Feasibility'
-
  !record {model: project.phase, id: project_phase_establishingprojectfeasibility0}:
    previous_phase_ids:
      - project_phase_definingclientsbasicideaofproject0


-
  Set previous phase for phase 'Preparation of Engineering Designs'
-
  !record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}:
    previous_phase_ids:
      - project_phase_establishingprojectfeasibility0

-
  Set previous phase for phase 'Procurement of Works and Goods'
-
  !record {model: project.phase, id: project_phase_procurementofworksandgoods0}:
    previous_phase_ids:
      - project_phase_preparationofengineeringdesigns0

-
  Set previous phase for phase 'Project Construction'
-
  !record {model: project.phase, id: project_phase_projectconstruction0}:
    previous_phase_ids:
      - project_phase_procurementofworksandgoods0


-
  Set previous phase for phase 'Project Completion'
-
  !record {model: project.phase, id: project_phase_projectcompletion0}:
    previous_phase_ids:
      - project_phase_projectconstruction0


-
  Get the project to schedule phases
-
  !record {model: project.compute.phases, id: project_compute_phases_0}:
    project_id: project_project_worldbanksproject0
    target_project: one


-
  Schedule project phases
-
  !python {model: project.project}: |
    self.schedule_phases(cr, uid, ref("project_project_worldbanksproject0"))

-
  Check if phases scheduled, check that either of phase's start_date, end_date and user_id is not null
-
  !python {model: project.project}: |
     prj=self.browse(cr, uid, [ref("project_project_worldbanksproject0")])[0]
     for phase in prj.phase_ids:
        if (not phase.responsible_id) or (not phase.date_start) or (not phase.date_end):
     	   raise AssertionError("Tasks not scheduled")


