diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index 970f5d4f5a1..f79c2a34224 100644 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -1,55 +1,23 @@ - - I test project template feature. + Test project template feature - - I create test project 'OpenERP Test Programme'. -- - !record {model: project.project, id: project_project_testprogramme0}: - company_id: base.main_company - name: OpenERP Training Programm -- - I assign an email address to Administrator for communications. -- - !record {model: res.users, id: base.user_root}: - user_email: admin@openerp.com -- - I create analytic account for assigned partner in project. -- - !record {model: account.analytic.account, id: account_analytic_account0}: - name : account_analytic_account - partner_id: base.res_partner_asus -- - I create project 'OpenERP Training Programme'. + Create project 'OpenERP Training Programme' - !record {model: project.project, id: project_project_openerptrainingprogramme0}: company_id: base.main_company - parent_id: account_analytic_account0 - partner_id: base.res_partner_asus name: OpenERP Training Programme - date_start: !eval time.strftime('%Y-%m-%d') - date: !eval time.strftime('%Y-%m-%d') - - I create task 'Technical Training' for 'OpenERP Training Programme' project. + Create task 'Technical Training' for this project - !record {model: project.task, id: project_task_technicaltraining0}: date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Technical Training - user_id: base.user_root planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 state: draft - - I create child task 'Training' of 'OpenERP Training Programme' project. -- - !record {model: project.task, id: project_task_child0}: - date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') - name: Training - planned_hours: 30.0 - project_id: project_project_openerptrainingprogramme0 - remaining_hours: 30.0 - state: done -- - I create task 'Functional Training' for 'OpenERP Training Programme' project. + Create task 'Functional Training' for this project - !record {model: project.task, id: project_task_functionaltraining0}: date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') @@ -57,116 +25,21 @@ planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 remaining_hours: 30.0 - child_ids: - - project_task_child0 state: draft - - I set project's task view. -- - !python {model: project.task}: | - context.update({'project_id': ref('project_task_functionaltraining0')}) - self._default_project(cr, uid,context) - #self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) -- - I click on Draft button. -- - !python {model: project.task}: | - self.do_draft(cr, uid, [ref("project_task_functionaltraining0")], context={}) -- - I click on Start task button. -- - !python {model: project.task}: | - self.do_open(cr, uid,[ref("project_task_functionaltraining0")],context={}) -- - I click Pending button. -- - !python {model: project.task}: | - self.do_pending(cr, uid, [ref("project_task_functionaltraining0")], context={}) -- - I click on Start task button. -- - !python {model: project.task}: | - self.do_open(cr, uid,[ref("project_task_functionaltraining0")],context={}) -- - I check is there any child task assigned to 'Functional Training' task. -- - !python {model: project.task}: | - self._check_child_task(cr, uid, [ref("project_task_functionaltraining0")]) -- - I do some changes on project without define partner. -- - !python {model: project.task}: | - self.onchange_project(cr, uid, [ref("project_task_functionaltraining0")],[]) -- - I do some changes on project. -- - !python {model: project.task}: | - self.onchange_project(cr, uid, [ref("project_task_functionaltraining0")],ref('project_project_openerptrainingprogramme0')) -- - I change the type of project. -- - !python {model: project.task}: | - self._change_type(cr, uid,[ref("project_task_functionaltraining0")], next, context) -- - I click on next button for change the type of project task. -- - !python {model: project.task}: | - self.next_type(cr, uid,[ref("project_task_functionaltraining0")], context) -- - I click on previous button for go back to previous type of task. -- - !python {model: project.task}: | - self.prev_type(cr, uid,[ref("project_task_functionaltraining0")], context) -- - I create work for project's task. -- - !record {model: project.task.work, id: project_task_work0}: - name: Technical Training Task's Work - task_id: project_task_technicaltraining0 -- - I create project's Work. -- - !python {model: project.task.work}: | - vals = { - 'name': 'Technical Training', - 'hours': 0.0, - 'task_id': ref('project_task_technicaltraining0'), - } - self.create(cr, uid, vals,context={"lang": "en_US", "active_ids": [ref("project_task_functionaltraining0")],"tz": False, "active_id": ref("project_task_functionaltraining0")}) -- - I add project's Work. -- - !python {model: project.task.work}: | - vals = { - 'name': 'Technical Training', - 'hours': 0.0, - 'task_id': ref('project_task_technicaltraining0'), - } - self.write(cr, uid, [ref('project_task_work0')], vals, context={"lang": "en_US", "active_ids": [ref("project_task_functionaltraining0")],"tz": False, "active_id": ref("project_task_functionaltraining0")}) -- - I get project's Work. -- - !python {model: project.project}: | - self._get_project_work(cr, uid, [ref("project_task_work0")], context={"lang": "en_US", "active_ids": [ref("project_task_functionaltraining0")],"tz": False, "active_id": ref("project_task_functionaltraining0")}) -- - I change the project's partner if needed. -- - !python {model: project.project}: | - self.onchange_partner_id(cr, uid, [ref("project_project_openerptrainingprogramme0")], part=ref('base.res_partner_asus'), context = {"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")}) -- - I set 'OpenERP Training Programme' project as project template. + 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"), }) - - I check if project in template state. + Check if project in template state - !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}: - state == "template" - - I create new project based on this template. + Create new project based on this template - !python {model: project.project}: | new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], @@ -180,7 +53,7 @@ name = new_prj['name'] assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state - - I reset project template to normal project 'OpenERP Training Programme'. + Reset project template to normal project - !python {model: project.project}: | self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": @@ -188,14 +61,14 @@ "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) - - I check if project in open state. + Check if project in open state - !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - - I test for different project-states. + Test for different project-states - - Keep project pending. + Keep project pending - !python {model: project.project}: | self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": @@ -203,64 +76,54 @@ "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), }) - - I check if project in pending state. + Check if project in pending state - !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}: - state == "pending" - - I cancel the project. -- + 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"), }) - - I check if project in cancel state. + 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. + 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"), }) - - Re-Check if project in open state. + Check if project in open state - !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: - state == "open" - - I test for task work allocation. + Test for task work allocation - - As I cancelled my project before, i check if the task 'Technical Training' is in cancelled state. + As i cancelled my project before, i check if the task 'Technical Training' is in cancelled state - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in cancelled state}: - state == "cancelled" - - Now, in order to reactivate the task 'Technical Training', i click on the "Reactivate" button and fill the remaining hour field. + Now in order to reactivate the task 'Technical Training', i click on the "Reactivate" button and fill the remaining hour field - !record {model: project.task.reevaluate, id: project_task_technicaltraining_remainingwiz0}: remaining_hours: 30.0 - | - I create the view for reevaluate the task. -- - !python {model: project.task.reevaluate}: | - self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) -- | - Now get the remaining hours required to close the task. -- - !python {model: project.task.reevaluate}: | - self._get_remaining(cr, uid,{'active_id':ref('project_task_functionaltraining0') }) -- | - I click the apply button for compute hours. + I click the apply button - !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref('project_task_technicaltraining_remainingwiz0')], {'active_id': ref("project_task_technicaltraining0"),'button_reactivate': True}) - | - I check if task 'Technical Training' in open state and for other initial values. + 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" @@ -269,7 +132,7 @@ - delay_hours == 0.0 - effective_hours == 0.0 - - I create a work task entry 'Training on OpenERP modules, models and classes' of 10 hours. + Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: @@ -278,13 +141,13 @@ name: Training on OpenERP modules, models and classes user_id: base.user_root - - I check for effective hours and remaining hours, effective_hours must be equal to 10. + 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 - - I create a work task entry 'Training on OpenERP xml views' of 10 hours. + Make a work task entry 'Training on OpenERP xml views' of 10 hours - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: @@ -293,13 +156,13 @@ name: Training on OpenERP xml views user_id: base.user_root - - I check for effective hours and remaining hours, effective_hours must be equal to 20. + 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 - - I create a work task entry 'Training on workflows' of 10 hours. + Make a work task entry 'Training on workflows' of 10 hours - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: @@ -308,19 +171,18 @@ name: Training on workflows user_id: base.user_root - - I check for effective hours and remaining hours, effective_hours must be equal to 30. + 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 - - - I set remaining hours of 10 hours for reevaluating the task. + Set remaining hours of 10 hours for reevaluating the task - !record {model: project.task.reevaluate, id: config_compute_remaining_0}: remaining_hours: 10.0 - - I reevaluate the task. + Reevaluate the task - !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", @@ -329,14 +191,14 @@ [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - - I check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30. + 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 - - I create a work task entry 'Training on reports and wizards' of 10 hours. + Make a work task entry 'Training on reports and wizards' of 10 hours - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: @@ -345,31 +207,33 @@ name: Training on reports and wizards user_id: base.user_root - - I check for effective hours and remaining hours. + 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 - - I close the task. + Close the task - !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) - - I check if task in done state. + Check if task in done state - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}: - state == "done" + + - - I test for task reactivation. + Test for task reactivation - - I reactivate task. + Reactivate task - !record {model: project.task.reevaluate, id: config_compute_remaining_1}: remaining_hours: 10.0 - - Reevaluate the task with 10 hours remaining. + Reevaluate the task with 10 hours remaining - !python {model: project.task.reevaluate}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", @@ -378,14 +242,14 @@ 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - - I check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30. + 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 - - I create a work task entry 'Training on yml' of 5 hours. + Make a work task entry 'Training on yml' of 5 hours - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: @@ -394,114 +258,39 @@ name: Training on yml user_id: base.user_root - - I check for effective hours and remaining hours, remaining_hours must be 5, effective_hours must be 45. + Check for effective hours and remaining hours, remaining_hours must be 5, effective_hours must be 45 - !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 - - Check for remaining hours. -- - !python {model: project.task}: | - self.onchange_remaining(cr, uid, [ref("project_task_functionaltraining0")], remaining = 10.0, planned = False) -- - I close the task. + Close the task - !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False}) - - I check if task in done state. + Check if task in done state - !assert {model: project.task, id: project_task_technicaltraining0, severity: error}: - state == "done" - - I check for effective hours and remaining hours. + 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 - - Now, Execute the search method. + Close project 'OpenERP Training Programme' - !python {model: project.project}: | - context.update({"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], + 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")}) - user = ref('base.user_demo') - try: - self.search(cr, user, args={}, offset=0, limit=None, order=None, context=None, count=False) - except: - pass + ref("project.menu_open_view_project_all"), }) - - I copy project 'OpenERP Training Programme'. -- - !python {model: project.project}: | - self.copy(cr, uid, ref("project_project_testprogramme0"), default={}, context=None) -- - I close project 'OpenERP Training Programme'. -- - !python {model: project.project}: | - context.update({"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")}) - user = ref('base.user_demo') - args={} - offset=0 - limit=None - order=None - count=False - try: - self.search(cr, user, args, offset, limit, order, context, count) - except: - pass - self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], context=context) - -- - I check if project in close state. + Check if project in close state - !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: "Project must be in closed state"}: - state == "close" -- - Now, unlink the task's work. -- - !python {model: project.task.work}: | - self.unlink(cr, uid, [ref('project_task_work0')]) -- - After remove project task's work unlink it's details from the analytic account. -- - !python {model: account.analytic.account}: | - vals = { - 'name' : 'account_analytic_account', - 'partner_id': ref('base.res_partner_asus') - } - self.create(cr, uid, vals, context=None) - self.unlink(cr, uid, [ref('account_analytic_account0')]) -- - I check for remaining hours. -- - !python {model: project.task}: | - self.onchange_remaining(cr, uid, [ref("project_task_functionaltraining0")], remaining = 0.0, planned = 0.0) -- - I change the planned. -- - !python {model: project.task}: | - self.onchange_planned(cr, uid, [ref("project_task_functionaltraining0")], planned = 0.0, effective = 0.0) -- - I cancel this project. -- - !python {model: project.task}: | - self.do_cancel(cr, uid,[ref("project_task_functionaltraining0")],context={}) - self.action_close(cr, uid, [ref("project_task_functionaltraining0")], context=None) -- - Now, unlink this project's task. -- - !python {model: project.task}: | - self.unlink(cr, uid,[ref("project_task_functionaltraining0")]) -- - Now, unlink the project. -- - !python {model: project.project}: | - self.unlink(cr, uid, [ref('project_project_testprogramme0')]) diff --git a/addons/project/test/test_project_delegation.yml b/addons/project/test/test_project_delegation.yml index 682ef8ce75a..02bc9afaae8 100644 --- a/addons/project/test/test_project_delegation.yml +++ b/addons/project/test/test_project_delegation.yml @@ -1,124 +1,115 @@ - - This scenario tests the delegation process. Closing all the delegated tasks(task delegation at multiple levels) transits the parent task from pending to open state. -- - I create a project OpenERP Documentation. -- + This scenario tests the delegation process. Closing all the delegated tasks(task delegation at multiple levels) transits the parent task from pending to open state. +- + Creating a project OpenERP Documentation +- !record {model: project.project, id: project_project_openerpdocumentation0}: company_id: base.main_company - name: OpenERP Documentation - -- - I create a task 'Develop book for Technical and Functional reference'. -- + name: OpenERP Documentation + +- + Creating a task 'Develop book for Technical and Functional reference' +- !record {model: project.task, id: project_task_documentation_book}: name: Develop book for Technical and Functional reference planned_hours: 20.0 project_id: project_project_openerpdocumentation0 remaining_hours: 20.0 - state: pending -- - I open the 'Develop book for Technical and Functional reference' task. -- + state: draft + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_documentation_book")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], - "tz": False, "active_id": ref("project.menu_action_view_task"), }) -- - I create a task 'Publish the References'. -- + "tz": False, "active_id": ref("project.menu_action_view_task"), }) + +- + Creating a task 'Publish the References' +- !record {model: project.task, id: project_task_publish_book}: name: Publish the References planned_hours: 10.0 project_id: project_project_openerpdocumentation0 remaining_hours: 10.0 state: draft - -- - I open the task 'Publish the References'. -- + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_publish_book")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], - "tz": False, "active_id": ref("project.menu_action_view_task"), }) + "tz": False, "active_id": ref("project.menu_action_view_task"), }) - - I test the delegate wizard. -- - I create a delegate task 'Publish the References' of 15 hours, renaming parent task to 'CHECK Publish the References' of 1 hour. -- + Test the delegate wizard +- + Creating a delegate task 'Publish the References' of 15 hours, renaming parent task to 'CHECK Publish the References' of 1 hour +- !record {model: project.task.delegate, id: project_task_publish_book_delegate}: name: Publish the References - new_task_description: test_new_task + new_task_description: aaa planned_hours: 15.0 planned_hours_me: 1.0 prefix: 'CHECK: Publish the References' state: pending user_id: base.user_demo -- - I create view for delegate task. -- + +- + Validating the delegate task +- !python {model: project.task.delegate}: | - fields = { - 'name' : 'Test', - 'new_task_description' : 'test_new_task', - 'planned_hours' : '15.0', - 'planned_hours_me' : '1.0', - 'prefix' : 'CHECK_Publish the References', - 'state' : 'pending', - 'user_id' : 'base.user_root' - } - context = {"lang": "en_US", "active_model": "project.task", "tz": False,"record_id":4, "active_ids": [ref("project_task_publish_book")], "active_id": ref("project_task_publish_book")} - self.default_get(cr, uid, fields, context=context) - self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) -- - I validate the delegate task. -- - !python {model: project.task.delegate}: | - self.delegate(cr, uid, [ref('project_task_publish_book_delegate')], {"active_id": ref("project_task_publish_book")}) -- - I check if parent task 'CHECK Publish the References' is in pending state. + self.delegate(cr, uid, [ref("project_task_publish_book_delegate")], + {"lang": "en_US", "active_model": "project.task", "tz": False, "record_id": + 4, "active_ids": [ref("project_task_publish_book")], "active_id": ref("project_task_publish_book"), + }) + - + Check if parent task 'CHECK Publish the References' is in pending state +- !assert {model: project.task, id: project_task_publish_book, severity: error, string: "Task must be in pending state after delegation"}: - - state == "pending" -- - I create a delegate task 'Prepare a book that gives functional overview of OpenERP'. -- + - state == "pending" +- + Creating a delegate task 'Prepare a book that gives functional overview of OpenERP' +- !record {model: project.task, id: project_task_delegate_openerp_tutorial}: name: Prepare a book that gives functional overview of OpenERP planned_hours: 30.0 project_id: project.project_project_openerpdocumentation0 remaining_hours: 30.0 state: draft - -- - I open the delegate task 'Prepare a book that gives functional overview of OpenERP'. -- + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_delegate_openerp_tutorial")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_id": ref("project.menu_action_view_task"), }) - -- - I create a delegate task 'Prepare a technical reference for creating your modules'. -- + +- + Creating a delegate task 'Prepare a technical reference for creating your modules' +- !record {model: project.task, id: project_task_delegate_developer_book}: name: Prepare a technical reference for creating your modules planned_hours: 30.0 project_id: project_project_openerpdocumentation0 remaining_hours: 30.0 state: draft - -- - I open the delegate task 'Prepare a technical reference for creating your modules'. -- + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_delegate_developer_book")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_id": ref("project.menu_action_view_task"), }) -- - I delegate task 'Develop book for Technical and Functional reference' to these tasks and make it pending. -- +- + Delegate task 'Develop book for Technical and Functional reference' to these tasks and make it pending +- !record {model: project.task, id: project_task_documentation_book}: child_ids: - project.project_task_delegate_openerp_tutorial @@ -126,20 +117,20 @@ planned_hours: 20.0 state: pending -- - I create a delegate task 'Prepare documentation for Module Development'. -- +- + Creating a delegate task 'Prepare documentation for Module Development' +- !record {model: project.task, id: project_task_delegate_module_develop}: name: Prepare documentation for Module Development planned_hours: 30.0 project_id: project.project_project_openerpdocumentation0 remaining_hours: 30.0 state: draft + - -- - I create a delegate 'Prepare documentation for Business Process Development'. -- +- + Creating a delegate 'Prepare documentation for Business Process Development' +- !record {model: project.task, id: project_task_delegate_business_process_develop}: name: Prepare documentation for Business Process Development planned_hours: 30.0 @@ -147,9 +138,9 @@ remaining_hours: 30.0 state: draft -- - I delegate task 'Prepare a technical reference for creating your modules' to these tasks and make it pending. -- +- + Delegate task 'Prepare a technical reference for creating your modules' to these tasks and make it pending +- !record {model: project.task, id: project_task_delegate_developer_book}: child_ids: - project.project_task_delegate_module_develop @@ -157,82 +148,83 @@ planned_hours: 20.0 state: pending -- - I open the task 'Prepare documentation for Business Process Development'. -- +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_delegate_module_develop")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_id": ref("project.menu_action_view_task"), }) - -- - I open the task 'Prepare documentation for Business Process Development'. -- + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_delegate_business_process_develop")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")], - "tz": False, "active_id": ref("project.menu_action_view_task"), }) -- - I check if 'Prepare a technical reference for creating your modules' in pending state. -- + "tz": False, "active_id": ref("project.menu_action_view_task"), }) + +- + Check if 'Prepare a technical reference for creating your modules' in pending state +- !assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task must be in pending state}: - state == "pending" - -- - I close the child task 'Prepare documentation for Module Development'. -- + +- + Close the child task 'Prepare documentation for Module Development' +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_delegate_module_develop")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model": "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"), }) - -- - I close the child task 'Prepare documentation for Business Process Development'. -- + +- + Close the child task 'Prepare documentation for Business Process Development' +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_delegate_business_process_develop")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model": "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"), }) - -- - Parent task 'Prepare a technical reference for creating your modules' task must now be in open state. -- + +- + Parent task 'Prepare a technical reference for creating your modules' task must now be in open state +- !assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task is in done state}: - state == "open" - - -- - I check if task 'Develop book for Technical and Functional reference' in pending state. -- + + +- + Check if task 'Develop book for Technical and Functional reference' in pending state +- !assert {model: project.task, id: project_task_documentation_book, severity: error, string: Task is in pending state}: - state == "pending" - -- - I close the child task 'Prepare a technical reference for creating your modules'. -- + +- + Close the child task 'Prepare a technical reference for creating your modules' +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_delegate_developer_book")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model": "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"), }) - -- - I close the child task 'Prepare a book that gives functional overview of OpenERP'. -- + +- + Close the child task 'Prepare a book that gives functional overview of OpenERP' +- !python {model: project.task}: | self.do_close(cr, uid, [ref("project_task_delegate_openerp_tutorial")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model": "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id": 1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"), }) - -- - Parent task 'Develop book for Technical and Functional reference' must be now in open state. -- + +- + Parent task 'Develop book for Technical and Functional reference' must be now in open state +- !assert {model: project.task, id: project_task_documentation_book, severity: error, string: Task is in done state}: - - state == "open" + - state == "open" diff --git a/addons/project_gtd/test/gtd_test.yml b/addons/project_gtd/test/gtd_test.yml index 539180db2ed..5c05dfd76cc 100644 --- a/addons/project_gtd/test/gtd_test.yml +++ b/addons/project_gtd/test/gtd_test.yml @@ -1,6 +1,6 @@ -- - I create a task 'Develop time management module' with monthly timebox. -- +- + Create a task 'Develop time management module' with monthly timebox +- !record {model: project.task, id: project_task_developtimemanagementmodule0}: name: Develop time management module planned_hours: 15.0 @@ -8,30 +8,11 @@ remaining_hours: 15.0 state: draft timebox_id: project_gtd.timebox_monthly -- - I copy the task. -- - !python {model: project.task}: | - self.copy_data(cr, uid, ref("project_task_developtimemanagementmodule0"), default=None, context=None) -- - Set the different view types like form and search for this object. -- - !python {model: project.task}: | - self.fields_view_get(cr, uid, view_id=None, view_type='form', context={'active_id':ref('project_task_developtimemanagementmodule0')}, toolbar=False, submenu=False) - self.fields_view_get(cr, uid, view_id=None, view_type='search', context={'active_id':ref('project_task_developtimemanagementmodule0')}, toolbar=False, submenu=False) -- - I change the time to next. -- - !python {model: project.task}: | - self.next_timebox(cr, uid, [ref("project_task_developtimemanagementmodule0")]) -- - I change the time to previous. -- - !python {model: project.task}: | - self.prev_timebox(cr, uid, [ref("project_task_developtimemanagementmodule0")]) -- - Open the task. -- + + +- + Open the task +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_developtimemanagementmodule0")], {"lang": "en_US", "project_id": False, "tz": False, "active_model": "ir.ui.menu", @@ -39,54 +20,59 @@ False, "search_default_user_id": 1, "search_default_current": 1, "active_ids": [ref("project.menu_action_view_task")], "active_id": ref("project.menu_action_view_task"), }) -- - I create time box for next week. -- + +- + Create time box for next week +- !record {model: project.gtd.timebox, id: project_gtd_timebox_nextweek0}: name: Next Week sequence: 0.0 -- - I create time box for tomorrow. -- + +- + Create time box for tomorrow +- !record {model: project.gtd.timebox, id: project_gtd_timebox_tomorrow1}: name: Tomorrow sequence: 0.0 -- - Planify the task from monthly timebox to tomorrow timebox. -- + +- + Planify the task from monthly timebox to tomorrow timebox +- !record {model: project.timebox.fill.plan, id: project_timebox_fill_plan_0}: task_ids: - project_task_developtimemanagementmodule0 timebox_id: project_gtd.timebox_monthly timebox_to_id: project_gtd_timebox_tomorrow1 -- - Set the task to tomorrow timebox. -- + + +- + Set the task to tomorrow timebox +- !python {model: project.timebox.fill.plan}: | - self._get_from_tb(cr, uid, context=None) - self._get_to_tb(cr, uid, context=None) self.process(cr, uid, [ref("project_timebox_fill_plan_0")], {"lang": "en_US", "project_id": False, "tz": False, "active_model": "project.gtd.timebox", "department_id": False, "section_id": False, "record_id": 1, "active_ids": [ref("project_gtd.timebox_daily")], "active_id": ref("project_gtd.timebox_daily"), }) + - - I check if task set to tomorrow timebox. + Check if task set to tomorrow timebox - !assert {model: project.task, id: project_task_developtimemanagementmodule0, string: Task set to tomorrow timebox}: - timebox_id.id == ref("project_gtd_timebox_tomorrow1") + - - Empty Timebox for tomorrow. + Empty Timebox for tomorrow - !python {model: project.timebox.empty}: | - self.view_init(cr , uid , fields_list={}, context=None) self._empty(cr, uid, {"lang": "en_US", "project_id": False, "tz": False, "active_model": "project.gtd.timebox", "department_id": False, "section_id": False, "record_id": 1, "active_ids": [ref("project_gtd_timebox_tomorrow1")], "active_id": ref("project_gtd_timebox_tomorrow1"), }) + - - I check task 'Develop time management module' is no more in tomorrow timebox. + Check task 'Develop time management module' is no more in tomorrow timebox - - !assert {model: project.task, id: project_task_developtimemanagementmodule0, string: Task is not in tomorrow timebox}: - - timebox_id.id != ref("project_gtd_timebox_tomorrow1") + !assert {model: project.task, id: project_task_developtimemanagementmodule0, string: Task is not in tomorrow timebox}: + - timebox_id.id != ref("project_gtd_timebox_tomorrow1") \ No newline at end of file diff --git a/addons/project_issue/test/convert_issue_to_task.yml b/addons/project_issue/test/convert_issue_to_task.yml index d6d0fe10fb3..13ddef69251 100644 --- a/addons/project_issue/test/convert_issue_to_task.yml +++ b/addons/project_issue/test/convert_issue_to_task.yml @@ -1,60 +1,23 @@ - - I create project 'OpenERP Training Programme'. -- - !record {model: project.project, id: project_issue_0}: - name: project issue training programme -- - I create task 'Training' for this project. -- - !record {model: project.task, id: project_task_training0}: - date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') - name: Technical Training - user_id: base.user_root - planned_hours: 30.0 - remaining_hours: 30.0 - state: draft - project_id: project_issue_0 -- - I create a project issue. + Create an issue - !record {model: project.issue, id: project_issue_onchangeevent0}: categ_id: project_issue.bug_categ - date_open: !eval time.strftime('%Y-%m-%d') name: on_change event does not pass context to the method - project_id: project_issue_0 - task_id: project_task_training0 + project_id: project.project_project_22 working_hours_close: 0.0 working_hours_open: 0.0 + - - I check there is no task attached to project issue. + Check there is no task attached to issue - !assert {model: project.issue, id: project_issue_onchangeevent0, string: There must not be any task attached to issue}: - task_id.id == False + - - I compute the days. + Convert issue to task - !python {model: project.issue}: | - import time - args = {} - fields = { - 'categ_id': ref('project_issue.bug_categ'), - 'date_open': time.strftime('%Y-%m-%d'), - 'name': 'on_change event does not pass context to the method', - 'project_id': ref('project_issue_0'), - 'task_id': ref('project_task_training0'), - 'working_hours_close': 0.0, - 'working_hours_open': 0.0, - 'days_since_creation':'' - } - self._compute_day(cr, uid, [ref('project_issue_onchangeevent0')], fields, args, context=None) -- - I convert project issue to task. -- - !python {model: project.issue}: | - try: - self._get_issue_work(cr, uid, [ref('project_issue_onchangeevent0')], context=None) - except: - pass self.convert_issue_task(cr, uid, [ref("project_issue_onchangeevent0")], {"lang": "en_US", "project_id": False, "tz": False, "active_model": "ir.ui.menu", "department_id": False, "section_id": False, "search_default_project_id": @@ -63,73 +26,7 @@ ref("project_issue.menu_project_issue_track"), }) - - I check there is a task attached to project issue. + Check there is a task attached to issue - !assert {model: project.issue, id: project_issue_onchangeevent0, string: After creating a task for the issue there must be a task attached to it}: - task_id.id != False -- - Get project issue's task work. -- - !python {model: project.issue}: | - context.update({'project_id':ref('project_issue_0')}) - self._get_project(cr, uid, context) -- - I creat some changes on project. -- - !python {model: project.issue}: | - self.on_change_project(cr, uid, [ref("project_issue_onchangeevent0")],context) -- - Now, go to next issue. -- - !python {model: project.issue}: | - self.next_type(cr, uid, [ref("project_issue_onchangeevent0")]) -- - Now, go to Previous issue. -- - !python {model: project.issue}: | - self.prev_type(cr, uid, [ref("project_issue_onchangeevent0")]) -- - I check the task. -- - !python {model: project.issue}: | - self.onchange_task_id(cr, uid, [ref("project_issue_onchangeevent0")], ref('project_task_training0'),context=None) -- - I convert Issue to Feature. -- - !python {model: project.issue}: | - self.convert_to_feature(cr, uid, [ref("project_issue_onchangeevent0")]) -- - I convert Issue to Bug. -- - !python {model: project.issue}: | - self.convert_to_bug(cr, uid, [ref("project_issue_onchangeevent0")]) -- - I copy the issue. -- - !python {model: project.issue}: | - default=None - context=None - self.copy(cr, uid, ref("project_issue_onchangeevent0"),default, context) -- - I create Message. -- - !python {model: project.issue}: | - msg = { - 'subject': 'test_email', - 'body_text': 'Testing Project Issue', - 'from': 'Administrator ', - } - self.message_new(cr, uid,msg,context) -- - I update this messages. -- - !python {model: project.issue}: | - msg = { - 'subject': 'test_email', - 'body_text': 'Testing Project Issue', - 'from': 'Administrator ', - } - context = None - default_act = 'pending' - self.message_update(cr, uid, [ref('project_issue_onchangeevent0')], msg,context) - diff --git a/addons/project_issue/test/test_project_issue_states.yml b/addons/project_issue/test/test_project_issue_states.yml index b903e032499..ee48c9a9df0 100644 --- a/addons/project_issue/test/test_project_issue_states.yml +++ b/addons/project_issue/test/test_project_issue_states.yml @@ -1,45 +1,36 @@ - - I assign an Escalation project as "Study + Prototype". -- - !record {model: project.project, id: project.project_project_22}: - project_escalation_id: project.project_project_21 -- - I check escalate the project assign. -- - !python {model: project.project}: | - self._check_escalation(cr, uid, [ref('project.project_project_22')], context=None) -- - I create an issue for "Specific Developments" project. + Create an issue - !record {model: project.issue, id: project_issue_stockmovedates0}: categ_id: project_issue.bug_categ name: Stock Move dates - task_id: project_task_training0 project_id: project.project_project_22 working_hours_close: 0.0 working_hours_open: 0.0 -- - I check if issue in 'draft' state. +- + Check if issue in 'draft' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in draft state}: - state == 'draft' -- - I open the issue. -- + +- + Open the issue +- !python {model: project.issue}: | self.case_open(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - I check if issue in 'open' state. +- + Check if issue in 'open' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in open state}: - state == 'open' -- - Keep issue pending. -- + +- + Keep issue pending +- !python {model: project.issue}: | self.case_pending(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], @@ -47,37 +38,32 @@ False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - Keep issue in 'Escalate' state. -- - !python {model: project.issue}: | - self.case_escalate(cr, uid, [ref("project_issue_stockmovedates0")],{"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], - "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": - False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": - 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), - }) -- - I check if issue in 'Escalate' state. +- + Check if issue in 'pending' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in pending state}: - state == 'pending' -- - I open the issue. -- + + +- + Open the issue +- !python {model: project.issue}: | self.case_open(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - I check if issue in 'open' state. +- + Check if issue in 'open' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in open state}: - state == 'open' -- - I cancel the issue. -- + + +- + Cancel the issue +- !python {model: project.issue}: | self.case_cancel(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], @@ -85,14 +71,16 @@ False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - I check if issue in 'cancel' state. +- + Check if issue in 'cancel' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in cancel state}: - state == 'cancel' -- - Now, reset the issue. -- + + +- + Reset the issue +- !python {model: project.issue}: | self.case_reset(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], @@ -100,14 +88,16 @@ False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - I check if issue in 'draft' state. +- + Check if issue in 'draft' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in draft state}: - state == 'draft' -- - I close the issue. -- + + +- + Close the issue +- !python {model: project.issue}: | self.case_close(cr, uid, [ref("project_issue_stockmovedates0")], {"lang": "en_US", "active_ids": [ref("project_issue.menu_project_issue_track")], @@ -115,8 +105,8 @@ False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs": 1, "project_id": False, "active_id": ref("project_issue.menu_project_issue_track"), }) -- - I check if issue in 'done' state. +- + Check if issue in 'done' state - !assert {model: project.issue, id: project_issue_stockmovedates0, severity: error, string: Issue is in done state}: - state == 'done' diff --git a/addons/project_issue_sheet/__openerp__.py b/addons/project_issue_sheet/__openerp__.py index bf9e23fdb77..cc1cd6504b0 100644 --- a/addons/project_issue_sheet/__openerp__.py +++ b/addons/project_issue_sheet/__openerp__.py @@ -45,7 +45,6 @@ Worklogs can be maintained to signify number of hours spent by users to handle a ], 'demo_xml': [ ], - 'test': ['test/test_project_issue_sheet.yml'], 'installable': True, 'active': False, 'certificate' : '00856032058128997037', diff --git a/addons/project_issue_sheet/test/test_project_issue_sheet.yml b/addons/project_issue_sheet/test/test_project_issue_sheet.yml deleted file mode 100644 index be06baadeb6..00000000000 --- a/addons/project_issue_sheet/test/test_project_issue_sheet.yml +++ /dev/null @@ -1,28 +0,0 @@ -- - I create analytic account. -- - !record {model: account.analytic.account, id: account_analytic_account1}: - name : account_analytic_account - partner_id: base.res_partner_asus -- - I create a project issue. -- - !record {model: project.issue, id: project_issue_onchangeevent1}: - categ_id: project_issue.bug_categ - date_open: !eval time.strftime('%Y-%m-%d') - name: on_change event does not pass context to the method - project_id: project.project_project_22 - working_hours_close: 0.0 - working_hours_open: 0.0 -- - I change the project. -- - !python {model: project.issue}: | - project_id = ref('project.project_project_21') - self.on_change_project(cr, uid, [ref('project_issue_onchangeevent1')], project_id, context) -- - I add analytic account. -- - !python {model: project.issue}: | - account_id = ref('account_analytic_account1') - self.on_change_account_id(cr, uid, [ref('project_issue_onchangeevent1')], account_id, context) diff --git a/addons/project_long_term/test/phase_constraint.yml b/addons/project_long_term/test/phase_constraint.yml index ff0f847fefb..ad1a3db095e 100644 --- a/addons/project_long_term/test/phase_constraint.yml +++ b/addons/project_long_term/test/phase_constraint.yml @@ -1,252 +1,117 @@ -- - I have a project 'Develop yaml Project Module'. -- +- + 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') -- - I have set Working Time from Monday to Friday from 9am to 17pm. -- - !record {model: resource.calendar, id: resource_calendar_hoursweeks0}: - name: "from Monday to Friday, from 9am to 17pm" - -- - I have set Day1 Working Time for Monday to Friday from 9am to 17pm working hour. -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day1" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "0" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day2 Working Time for Monday to Friday from 9am to 17pm working hour. -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day2" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "1" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day3 Working Time for Monday to Friday from 9am to 17pm working hour. -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day3" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "2" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day4 Working Time for Monday to Friday from 9am to 17pm working hour. -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day4" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "3" - calendar_id : resource_calendar_hoursweeks0 - -- - I have set Day5 Working Time for Monday to Friday from 9am to 17pm working hour. -- - !record {model: resource.calendar.attendance, id: resource_calendar_atendanceday1}: - name: "Day5" - hour_from : 09.00 - hour_to : 17.00 - dayofweek : "4" - calendar_id : resource_calendar_hoursweeks0 - - -- - Now Set working period to Project 'Develop yaml Project Module'. -- - !python {model: project.project}: | - context.update({'resource_calendar_id': ref("resource_calendar_hoursweeks0")}) - self.write(cr, uid, [ref("project_project_developyamlproject0")], context) - self.schedule_tasks(cr, uid, [ref('project_project_developyamlproject0')], context) - - for project in self.browse(cr, uid, [ref('project_project_developyamlproject0')], context): - start_date = project.date_start - end_date = start_date - context.update({'start_date' : start_date,'end_date' : end_date}) - self.compute_allocation(cr, uid, [ref('project_project_developyamlproject0')], start_date, end_date, context) - self.generate_members(cr, uid, [ref('project_project_developyamlproject0')], context=None) -- - I create 3 consecutive 5-days phases. - For that Creating a Analyst Human resource to analyst Project Yaml. -- + resource_calendar_id: resource.timesheet_group1 +- + And I create three human ressources to work on this project, an analyst. +- !record {model: resource.resource, id: resource_resource_analyst1}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: Analyst resource_type: user time_efficiency: 1.0 user_id: base.user_admin - -- - I create Developer Human resource who develop Yaml. -- +- + I define a developer HR. +- !record {model: resource.resource, id: resource_resource_develop0}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: Developer resource_type: user time_efficiency: 1.0 user_id: base.user_admin -- - I create a Tester Human resource for testing Yaml. -- +- + I define a tester HR. +- !record {model: resource.resource, id: resource_resource_tester1}: - calendar_id: project_long_term.resource_calendar_hoursweeks0 + calendar_id: resource.timesheet_group1 name: tester resource_type: user time_efficiency: 1.0 user_id: base.user_admin - -- - I create 3 a project phase and NO one depends on other one. - so,they should start on the same day. - I create First 'Analysis Flow for Yaml' Project Phase. -- +- + 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 Flow for Yaml" + name: "Analysis" product_uom: product.uom_day project_id: project_project_developyamlproject0 responsible_id: project.res_users_analyst state: draft -- - I update the Constrain Date Start adn Date End for phase Analysis Flow for Yaml. -- +- + 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=2) - end = datetime.date.today() + relativedelta(days=6) - self.write(cr,uid, [(ref("project_phase_analysisflowforyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) - -- - I create project phase 'Develop yaml' with constraint date. -- + 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: Develop Yaml + name: Development product_uom: product.uom_day project_id: project_project_developyamlproject0 - responsible_id: base.user_admin previous_phase_ids: - project_phase_analysisflowforyaml0 -- - I update the Constrain Date Start adn Date End for phase Develop yaml. -- +- + 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._get_default_uom_id(cr, uid) - self.write(cr,uid, [(ref("project_phase_developyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) -- - I create project phase 'Test Yaml'. + #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 Yaml + name: Testing product_uom: product.uom_day project_id: project_project_developyamlproject0 previous_phase_ids: - project_phase_developyaml0 - constraint_date_start : - constraint_date_end : -- - I compute Schedule of phases For One project. -- +- + 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 - -- - I schedule project phases using "Compute Phase Scheduling". -- +- !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') -- - After scheduling,check that. - Phase "Analysis Flow for Yaml" and "Test Yaml" Phase should start on the project start date while "Develop yaml" Phase should respect the constraint. -- - !python {model: project.project}: | - proj=self.browse(cr, uid, [ref("project_project_developyamlproject0")])[0] - for phase in proj.phase_ids: - for phase1 in proj.phase_ids: - if phase1.id != phase.id and phase.constraint_date_start == phase1.date_start: - raise AssertionError("Phases not scheduled") -- - Now, I am Checking constraint start and end for Phase 'Develop Yaml'. -- - !python {model: project.phase}: | - self._check_constraint_start(cr, uid, [ref("project_phase_developyaml0")],context) - self._check_constraint_end(cr, uid, [ref("project_phase_developyaml0")],context) -- - I am opening the Phase 'Develop Yaml'. -- - !python {model: project.phase}: | - self.set_open(cr, uid, [ref("project_phase_developyaml0")]) -- - Now, Compute the Total Hours. -- - !python {model: project.phase}: | - field_name = 'test' - arg = {} - self._compute(cr, uid, [ref("project_phase_developyaml0")], field_name, arg, context=None) + 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 0 -