2 In order to test process of Phases,
4 I create a record to schedule the phase of project.
6 !record {model: project.compute.phases, id: project_compute_phases01}:
8 project_id: project.project_project_1
10 I schedule the phases.
12 !python {model: project.compute.phases}: |
13 self.check_selection(cr, uid, [ref("project_compute_phases01")])
15 I check the starting date and ending date on the phases after scheduling.
17 !python {model: project.project}: |
18 project = self.browse(cr, uid, ref("project.project_project_1"), context=context)
21 return time.strptime(date, '%Y-%m-%d %H:%M:%S')
22 def _check(phase, _convert, _check): #TOFIX: why need to pass function ?
23 for next_phase in phase.next_phase_ids:
24 assert _convert(next_phase.date_start) >= _convert(phase.date_end), "Phase does not start in proper date."
25 _check(next_phase, _convert, _check)
28 for phase in project.phase_ids:
30 assert phase.date_start, "Start date should be computed."
31 assert phase.date_end, "End date should be computed."
32 if not phase.previous_phase_ids and phase.constraint_date_start:
33 assert _convert(phase.date_start) >= _convert(phase.constraint_date_start), "Phase does not start in proper date."
34 _check(phase, _convert, _check)
38 !python {model: project.phase}: |
39 self.set_open(cr, uid, [ref("project_phase_1")])
41 I check state of phase after opened.
43 !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}:
46 I put phase in pending state.
48 !python {model: project.phase}: |
49 self.set_pending(cr, uid, [ref("project_phase_1")])
51 I check state of phase after put in pending.
53 !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}:
56 I make Phase in cancel state.
58 !python {model: project.phase}: |
59 self.set_cancel(cr, uid, [ref("project_phase_1")])
61 I check state of phase after cancelled.
63 !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}:
64 - state == "cancelled"
66 I put again in draft phase.
68 !python {model: project.phase}: |
69 self.set_draft(cr, uid, [ref("project_phase_1")])
73 !python {model: project.phase}: |
74 self.set_done(cr, uid, [ref("project_phase_1")])
76 I check state of phase after closed.
78 !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in done state}: