[FIX] base_action_rule: prevent recursive rule trigger also when processing time...
[odoo/odoo.git] / addons / project_long_term / test / phase_process.yml
1 -
2   In order to test process of Phases,
3 -
4   I create a record to schedule the phase of project.
5 -
6   !record {model: project.compute.phases, id: project_compute_phases01}:
7     target_project: 'one'
8     project_id: project.project_project_1
9 -
10   I schedule the phases.
11 -
12   !python {model: project.compute.phases}: |
13     self.check_selection(cr, uid, [ref("project_compute_phases01")])
14 -
15   I check the starting date and ending date on the phases after scheduling.
16 -
17   !python {model: project.project}: |
18      project = self.browse(cr, uid, ref("project.project_project_1"), context=context)
19      def _convert(date):
20         import time
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)
26         return True
27      
28      for phase in project.phase_ids:
29         
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)
35 -
36   I open phase.
37 -
38   !python {model: project.phase}: |
39     self.set_open(cr, uid, [ref("project_phase_1")])
40 -
41   I check state of phase after opened.
42 -
43   !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}:
44     - state == "open"
45 -
46   I put phase in pending state.
47 -
48   !python {model: project.phase}: |
49     self.set_pending(cr, uid, [ref("project_phase_1")])
50 -
51   I check state of phase after put in pending.
52 -
53   !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}:
54     - state == "pending"
55 -
56   I make Phase in cancel state.
57 -
58   !python {model: project.phase}: |
59     self.set_cancel(cr, uid, [ref("project_phase_1")])
60 -
61   I check state of phase after cancelled.
62 -
63   !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}:
64     - state == "cancelled"
65 -
66   I put again in draft phase.
67 -
68   !python {model: project.phase}: |
69     self.set_draft(cr, uid, [ref("project_phase_1")])
70 -
71   I close phase.
72 -
73   !python {model: project.phase}: |
74     self.set_done(cr, uid, [ref("project_phase_1")])
75 -
76   I check state of phase after closed.
77 -
78   !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in done state}:
79     - state == "done"