mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
New project_sla module
This commit is contained in:
66
project_sla/test/project_sla.yml
Normal file
66
project_sla/test/project_sla.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
-
|
||||
Cleanup previous test run
|
||||
-
|
||||
!python {model: project.issue}: |
|
||||
res = self.search(cr, uid, [('name', '=', 'My monitor is flickering')])
|
||||
self.unlink(cr, uid, res)
|
||||
-
|
||||
Create a new Issue
|
||||
-
|
||||
!record {model: project.issue, id: issue1, view: False}:
|
||||
name: "My monitor is flickering"
|
||||
project_id: project.project_project_1
|
||||
priority: "3"
|
||||
user_id: base.user_root
|
||||
partner_id: base.res_partner_2
|
||||
email_from: agr@agrolait.com
|
||||
categ_ids:
|
||||
- project_issue.project_issue_category_01
|
||||
-
|
||||
Close the Issue
|
||||
-
|
||||
!python {model: project.issue}: |
|
||||
self.case_close(cr, uid, [ref("issue1")])
|
||||
-
|
||||
Force the Issue's Create Date and Close Date
|
||||
Created friday before opening hour, closed on next monday near closing hour
|
||||
-
|
||||
!python {model: project.issue}: |
|
||||
import time
|
||||
self.write(cr, uid, [ref("issue1"),], {
|
||||
'create_date': time.strftime('2013-11-22 06:15:00'),
|
||||
'date_closed': time.strftime('2013-11-25 16:45:00'),
|
||||
})
|
||||
-
|
||||
There should be Service Level info generated on the Issue
|
||||
-
|
||||
!assert {model: project.issue, id: issue1, string: Issue should have calculated service levels}:
|
||||
- len(sla_control_ids) == 2
|
||||
-
|
||||
Assign an additional "Response SLA" to the Contract
|
||||
-
|
||||
!python {model: account.analytic.account}: |
|
||||
self.write(cr, uid, [ref('project.project_project_1_account_analytic_account')],
|
||||
{'sla_ids': [(4, ref('sla_response'))]})
|
||||
-
|
||||
Button to Reapply the SLA Definition
|
||||
-
|
||||
!python {model: project.sla}: |
|
||||
self._reapply_slas(cr, uid, [ref('sla_resolution')], recalc_closed=True)
|
||||
-
|
||||
There should be two Service Level lines generated on the Issue
|
||||
-
|
||||
!assert {model: project.issue, id: issue1, string: Issue should have two calculated service levels}:
|
||||
- len(sla_control_ids) == 2
|
||||
-
|
||||
The Issue's Resolution SLA should be "3 business days"
|
||||
-
|
||||
!python {model: project.issue}: |
|
||||
issue = self.browse(cr, uid, ref('issue1'))
|
||||
for x in issue.sla_control_ids:
|
||||
print x.sla_line_id.name
|
||||
if x.sla_line_id.id == ref("sla_resolution_rule2"):
|
||||
assert x.sla_achieved == 1, "Issue resolution SLA should be achieved"
|
||||
break
|
||||
else:
|
||||
assert False, 'Issue Resolution SLA should be "3 business days"'
|
||||
Reference in New Issue
Block a user