diff options
Diffstat (limited to 'addons/project/test/test_project.yml')
| -rw-r--r-- | addons/project/test/test_project.yml | 322 |
1 files changed, 322 insertions, 0 deletions
diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml new file mode 100644 index 00000000000..25b3e94b57f --- /dev/null +++ b/addons/project/test/test_project.yml @@ -0,0 +1,322 @@ +- + Test project template feature +- + Create project 'OpenERP Training Programme' +- + !record {model: project.project, id: project_project_openerptrainingprogramme0}: + company_id: base.main_company + name: OpenERP Training Programme +- + Create task 'Technical Training' for this project +- + !record {model: project.task, id: project_task_technicaltraining0}: + date_start: '2010-05-31 11:48:38' + name: Technical Training + planned_hours: 30.0 + project_id: project_project_openerptrainingprogramme0 + remaining_hours: 30.0 + state: draft +- + Create task 'Functional Training' for this project +- + !record {model: project.task, id: project_task_functionaltraining0}: + date_start: '2010-05-31 11:49:11' + name: Functional Training + planned_hours: 30.0 + project_id: project_project_openerptrainingprogramme0 + remaining_hours: 30.0 + state: draft +- + Set project as project template +- + !python {model: project.project}: | + self.set_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], + {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) +- + Check if project in template state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}: + - state == "template" +- + Create new project based on this template +- + !python {model: project.project}: | + new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], + {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) + if not new_prj: + raise Exception( "New project based on template not created") + new_id = new_prj['res_id'] + state = self.read(cr, uid, [new_id], ['state'])[0]['state'] + assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state +- + Reset project template to normal project +- + !python {model: project.project}: | + self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in open state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: + - state == "open" + + + + +- + Test for different project-states +- + Keep project pending +- + !python {model: project.project}: | + self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in pending state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}: + - state == "pending" +- + Cancel the project +- + !python {model: project.project}: | + self.set_cancel(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in cancel state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in cancel state}: + - state == "cancelled" +- + Re-open the project +- + !python {model: project.project}: | + self.set_open(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": + ref("project.menu_open_view_project_all"), }) +- + Check if project in open state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: + - state == "open" + + + +- + Test for task work allocation +- + Check if task 'Technical Training' in draft state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in draft state}: + - state == "draft" +- + Open task 'Technical Training' +- + !python {model: project.task}: | + self.do_open(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task 'Technical Training' in open state and for other initial values +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in open state}: + - state == "open" + - planned_hours == 30 + - remaining_hours == 30 + - delay_hours == 0.0 + - total_hours == 30 + - effective_hours == 0.0 +- + Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 15:04:22' + hours: 10.0 + name: Training on OpenERP modules, models and classes + user_id: base.user_root +- + Check for effective hours and remaining hours, effective_hours must be equal to 10 +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}: + - remaining_hours == 20 + - effective_hours == 10.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on OpenERP xml views' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-06-01 15:04:46' + hours: 10.0 + name: Training on OpenERP xml views + user_id: base.user_root +- + Check for effective hours and remaining hours, effective_hours must be equal to 20 +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}: + - remaining_hours == 10 + - effective_hours == 20.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on workflows' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-06-02 15:05:24' + hours: 10.0 + name: Training on workflows + user_id: base.user_root +- + Check for effective hours and remaining hours, effective_hours must be equal to 30 +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}: + - remaining_hours == 0 + - effective_hours == 30.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Set remaining hours of 10 hours for reevaluating the task +- + !record {model: config.compute.remaining, id: config_compute_remaining_0}: + remaining_hours: 10.0 +- + Reevaluate the task +- + !python {model: config.compute.remaining}: | + self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", + "project_id": False, "tz": False, "active_model": "project.task", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "active_ids": + [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) + +- + Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 10.0 + - effective_hours == 30.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on reports and wizards' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 15:08:40' + hours: 10.0 + name: Training on reports and wizards + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 40 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 0 + - effective_hours == 40.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close the task +- + !python {model: project.task}: | + self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task in done state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}: + - state == "done" + + +- + Test for task reactivation +- + Reactivate task +- + !record {model: config.compute.remaining, id: config_compute_remaining_1}: + remaining_hours: 10.0 +- + Reevaluate the task with 10 hours remaining +- + !python {model: config.compute.remaining}: | + self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", + "project_id": False, "tz": False, "button_reactivate": True, "active_model": + "project.task", "search_default_project_id": False, "search_default_user_id": + 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), + }) +- + Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 10.0 + - effective_hours == 40.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on yml' of 5 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 16:55:27' + hours: 5.0 + name: Training on yml + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 5 hours effective_hours must be equal to 45 and remaining_hours is 5}: + - planned_hours == 30 + - remaining_hours == 5.0 + - effective_hours == 45.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close the task +- + !python {model: project.task}: | + self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task in done state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error}: + - state == "done" +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After closing the task planned_hours must remain 30 effective_hours must be 45 and remaining hours must be 0}: + - planned_hours == 30 + - remaining_hours == 0.0 + - effective_hours == 45.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close project 'OpenERP Training Programme' +- + !python {model: project.project}: | + self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": + ref("project.menu_open_view_project_all"), }) +- + Check if project in close state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error}: + - state == "close" +
\ No newline at end of file |
