[MERGE] trunk-usability rco
[odoo/odoo.git] / addons / project / test / test_project_delegation.yml
1 -
2   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.  
3
4   Creating a project OpenERP Documentation
5
6   !record {model: project.project, id: project_project_openerpdocumentation0}:
7     company_id: base.main_company
8     name: OpenERP Documentation    
9     
10
11   Creating a task 'Develop book for Technical and Functional reference'
12
13   !record {model: project.task, id: project_task_documentation_book}:
14     name: Develop book for Technical and Functional reference
15     planned_hours: 20.0
16     project_id: project_project_openerpdocumentation0
17     remaining_hours: 20.0
18     state: draft
19     
20
21   Open the task
22
23   !python {model: project.task}: |
24     self.do_open(cr, uid, [ref("project_task_documentation_book")],
25       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
26       "tz": False, "active_id": ref("project.menu_action_view_task"), }) 
27
28
29   Creating a task 'Publish the References'
30
31   !record {model: project.task, id: project_task_publish_book}:
32     name: Publish the References
33     planned_hours: 10.0
34     project_id: project_project_openerpdocumentation0
35     remaining_hours: 10.0
36     state: draft
37     
38
39   Open the task
40
41   !python {model: project.task}: |
42     self.do_open(cr, uid, [ref("project_task_publish_book")],
43       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
44       "tz": False, "active_id": ref("project.menu_action_view_task"), }) 
45
46 -
47   Test the delegate wizard 
48
49   Creating a delegate task 'Publish the References' of 15 hours, renaming parent task to 'CHECK Publish the References' of 1 hour
50
51   !record {model: project.task.delegate, id: project_task_publish_book_delegate}:
52     name: Publish the References
53     new_task_description: aaa
54     planned_hours: 15.0
55     planned_hours_me: 1.0
56     prefix: 'CHECK: Publish the References'
57     state: pending
58     user_id: base.user_demo
59     
60
61   Validating the delegate task
62
63   !python {model: project.task.delegate}: |
64     self.delegate(cr, uid, [ref("project_task_publish_book_delegate")],
65       {"lang": "en_US", "active_model": "project.task", "tz": False, "record_id":
66       4, "active_ids": [ref("project_task_publish_book")], "active_id": ref("project_task_publish_book"),
67       })
68
69 -
70   Check if parent task 'CHECK Publish the References' is in pending state
71
72   !assert {model: project.task, id: project_task_publish_book, severity: error, string: "Task must be in pending state after delegation"}:
73        - state == "pending"      
74
75   Creating a delegate task 'Prepare a book that gives functional overview of OpenERP' 
76
77   !record {model: project.task, id: project_task_delegate_openerp_tutorial}:
78     name: Prepare a book that gives functional overview of OpenERP
79     planned_hours: 30.0
80     project_id: project.project_project_openerpdocumentation0
81     remaining_hours: 30.0
82     state: draft
83     
84
85   Open the task
86
87   !python {model: project.task}: |
88     self.do_open(cr, uid, [ref("project_task_delegate_openerp_tutorial")],
89       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
90       "tz": False, "active_id": ref("project.menu_action_view_task"), })
91           
92
93   Creating a delegate task 'Prepare a technical reference for creating your modules'
94
95   !record {model: project.task, id: project_task_delegate_developer_book}:
96     name: Prepare a technical reference for creating your modules
97     planned_hours: 30.0
98     project_id: project_project_openerpdocumentation0
99     remaining_hours: 30.0
100     state: draft
101  
102
103   Open the task
104
105   !python {model: project.task}: |
106     self.do_open(cr, uid, [ref("project_task_delegate_developer_book")],
107       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
108       "tz": False, "active_id": ref("project.menu_action_view_task"), })
109
110
111   Delegate task 'Develop book for Technical and Functional reference' to these tasks and make it pending
112
113   !record {model: project.task, id: project_task_documentation_book}:
114     child_ids:
115       - project.project_task_delegate_openerp_tutorial
116       - project.project_task_delegate_developer_book
117     planned_hours: 20.0
118     state: pending
119
120
121   Creating a delegate task 'Prepare documentation for Module Development'
122
123   !record {model: project.task, id: project_task_delegate_module_develop}:
124     name: Prepare documentation for Module Development
125     planned_hours: 30.0
126     project_id: project.project_project_openerpdocumentation0
127     remaining_hours: 30.0
128     state: draft
129     
130
131
132   Creating a delegate 'Prepare documentation for Business Process Development'
133
134   !record {model: project.task, id: project_task_delegate_business_process_develop}:
135     name: Prepare documentation for Business Process Development
136     planned_hours: 30.0
137     project_id: project_project_openerpdocumentation0
138     remaining_hours: 30.0
139     state: draft
140
141
142   Delegate task 'Prepare a technical reference for creating your modules' to these tasks and make it pending
143
144   !record {model: project.task, id: project_task_delegate_developer_book}:
145     child_ids:
146       - project.project_task_delegate_module_develop
147       - project.project_task_delegate_business_process_develop
148     planned_hours: 20.0
149     state: pending
150
151
152   Open the task
153
154   !python {model: project.task}: |
155     self.do_open(cr, uid, [ref("project_task_delegate_module_develop")],
156       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
157       "tz": False, "active_id": ref("project.menu_action_view_task"), })
158       
159
160   Open the task
161
162   !python {model: project.task}: |
163     self.do_open(cr, uid, [ref("project_task_delegate_business_process_develop")],
164       {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
165       "tz": False, "active_id": ref("project.menu_action_view_task"), })      
166
167
168   Check if 'Prepare a technical reference for creating your modules' in pending state
169
170   !assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task must be in pending state}:
171        - state == "pending"
172                  
173
174   Close the child task 'Prepare documentation for Module Development'
175
176   !python {model: project.task}: |
177     self.do_close(cr, uid, [ref("project_task_delegate_module_develop")], {"lang": "en_US",
178       "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model":
179       "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id":
180       1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"),
181       })
182       
183
184   Close the child task 'Prepare documentation for Business Process Development'
185
186   !python {model: project.task}: |
187     self.do_close(cr, uid, [ref("project_task_delegate_business_process_develop")], {"lang": "en_US",
188       "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model":
189       "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id":
190       1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"),
191       })
192       
193
194   Parent task 'Prepare a technical reference for creating your modules' task must now be in open state
195
196   !assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task is in done state}:
197        - state == "open"
198        
199       
200
201   Check if task 'Develop book for Technical and Functional reference' in pending state
202
203   !assert {model: project.task, id: project_task_documentation_book, severity: error, string: Task is in pending state}:
204        - state == "pending"
205                  
206
207   Close the child task 'Prepare a technical reference for creating your modules'
208
209   !python {model: project.task}: |
210     self.do_close(cr, uid, [ref("project_task_delegate_developer_book")], {"lang": "en_US",
211       "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model":
212       "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id":
213       1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"),
214       })
215       
216
217   Close the child task 'Prepare a book that gives functional overview of OpenERP' 
218
219   !python {model: project.task}: |
220     self.do_close(cr, uid, [ref("project_task_delegate_openerp_tutorial")], {"lang": "en_US",
221       "active_ids": [ref("project.menu_action_view_task")], "tz": False, "active_model":
222       "ir.ui.menu", "section_id": False, "search_default_project_id": False, "search_default_user_id":
223       1, "search_default_current": 1, "mail_send": False, "active_id": ref("project.menu_action_view_task"),
224       })
225       
226
227   Parent task 'Develop book for Technical and Functional reference' must be now in open state 
228
229   !assert {model: project.task, id: project_task_documentation_book, severity: error, string: Task is in done state}:
230        - state == "open"