Files
odoo_source/addons/project_long_term/test/schedule_project_phases.yml
T

143 lines
4.4 KiB
YAML

-
Create a project 'World Bank's Project'
-
!record {model: project.project, id: project_project_worldbanksproject0}:
company_id: base.main_company
name: "World Bank's Project"
priority: 4
-
Create a project phase 'Defining Client's Basic Idea of Project'
-
!record {model: project.phase, id: project_phase_definingclientsbasicideaofproject0}:
date_start: '2010-06-02 00:00:00'
duration: 15.0
name: "Defining Client's Basic Idea of Project"
product_uom: product.uom_day
project_id: project_project_worldbanksproject0
state: draft
-
Create project phase 'Establishing Project Feasibility'
-
!record {model: project.phase, id: project_phase_establishingprojectfeasibility0}:
date_start: '2010-06-02 00:00:00'
duration: 30.0
name: Establishing Project Feasibility
product_uom: product.uom_day
project_id: project_project_worldbanksproject0
state: draft
-
Create project phase 'Preparation of Engineering Designs'
-
!record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}:
date_start: '2010-06-02 00:00:00'
duration: 100.0
name: Preparation of Engineering Designs
product_uom: product.uom_hour
project_id: project_project_worldbanksproject0
state: draft
-
Create project phase 'Procurement of Works and Goods'
-
!record {model: project.phase, id: project_phase_procurementofworksandgoods0}:
date_start: '2010-06-02 00:00:00'
duration: 24.0
name: Procurement of Works and Goods
product_uom: product.uom_hour
project_id: project_project_worldbanksproject0
state: draft
-
Create project phase 'Project Construction'
-
!record {model: project.phase, id: project_phase_projectconstruction0}:
date_start: '2010-06-02 00:00:00'
duration: 4320.0
name: Project Construction
product_uom: product.uom_hour
project_id: project_project_worldbanksproject0
state: draft
-
Create project phase 'Project Completion'
-
!record {model: project.phase, id: project_phase_projectcompletion0}:
date_start: '2010-06-02 00:00:00'
duration: 240.0
name: Project Completion
product_uom: product.uom_hour
project_id: project_project_worldbanksproject0
state: draft
-
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.compute.phases}: |
self.check_selection(cr, uid, [ref("project_compute_phases_0")], {"lang": "en_US",
"project_id": False, "tz": False, "active_model": "ir.ui.menu", "department_id":
False, "section_id": False, "record_id": 279, "active_ids": [ref("project_long_term.menu_compute_phase")],
"active_id": ref("project_long_term.menu_compute_phase"), })
-
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 task in prj.tasks:
if (not task.user_id) or (not task.date_start) or (not task.date_end):
raise AssertionError("Tasks not scheduled")