Files
odoo_source/addons/project_issue/test/convert_issue_to_task.yml
T

136 lines
4.4 KiB
YAML

-
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.
-
!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
working_hours_close: 0.0
working_hours_open: 0.0
-
I check there is no task attached to project 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.
-
!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":
False, "search_default_my_bugs": 1, "search_default_user_id": 1, "search_default_current_bugs":
1, "active_ids": [ref("project_issue.menu_project_issue_track")], "active_id":
ref("project_issue.menu_project_issue_track"), })
-
I check there is a task attached to project 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 <admin@openerp.com>',
}
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 <admin@openerp.com>',
}
context = None
default_act = 'pending'
self.message_update(cr, uid, [ref('project_issue_onchangeevent0')], msg,context)