[MERGE] merge with CHA branch to get all changes related to buttons improvment in...
[odoo/odoo.git] / addons / mrp_operations / test / workcenter_operations.yml
1 -
2   I compute the production order.
3 -
4   !python {model: mrp.production}: |
5     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
6     order.action_compute(context=context)
7 -
8   I check planned date in workcenter lines of production order.
9 -
10   !python {model: mrp.production}: |
11     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
12     for line in order.workcenter_lines:
13         #TODO: to check start date of next line should be end of date of previous line.
14         assert line.date_planned, "Planned Start date is not computed: %s" %(line)
15         assert line.date_planned_end, "Planned End date is not computed: %s" %(line)
16
17 -
18   I confirm the Production Order.
19 -
20   !workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_shelf100cm}
21 -  
22   I run scheduler.
23 -
24   !python {model: procurement.order}: |
25     self.run_scheduler(cr, uid)
26 -
27   I forcefully close internal shipment.
28 -
29   !python {model: mrp.production}: |
30     self.force_production(cr, uid, [ref("mrp.mrp_production_shelf100cm")])
31 -
32   I start production.
33 -
34   !workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_shelf100cm}
35
36   Production start on first work center, so I start work operation on first work center.
37 -
38   !python {model: mrp.production}: |
39     import netsvc
40     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
41     wf_service = netsvc.LocalService("workflow")
42     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
43 -
44   Now I pause first work operation due to technical fault of work center.
45 -
46   !python {model: mrp.production}: |
47     import netsvc
48     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
49     wf_service = netsvc.LocalService("workflow")
50     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_pause', cr)
51     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
52 -
53   I resume first work operation.
54 -
55   !python {model: mrp.production}: |
56     import netsvc
57     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
58     wf_service = netsvc.LocalService("workflow")
59     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
60     
61 -
62   I cancel first work operation.
63 -
64   !python {model: mrp.production}: |
65     import netsvc
66     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
67     wf_service = netsvc.LocalService("workflow")
68     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_cancel', cr)
69 -
70   I reset first work operation and start after resolve techninal fault of work center.
71 -
72   !python {model: mrp.production}: |
73     import netsvc
74     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
75     wf_service = netsvc.LocalService("workflow")
76     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_draft', cr)
77     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
78 -
79   Now Finished work of first work operation so I close that operation.
80 -
81   !python {model: mrp.production}: |
82     import netsvc
83     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
84     wf_service = netsvc.LocalService("workflow")
85     wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_done', cr)
86 -
87   Now I close other operations after start one by one.
88 -
89   !python {model: mrp.production}: |
90     import netsvc
91     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
92     wf_service = netsvc.LocalService("workflow")
93     for work_line in order.workcenter_lines[1:]:
94         wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_start_working', cr)
95         wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_done', cr)
96
97 -
98   I check that the production order is now done.
99 -
100   !python {model: mrp.production}: |
101     order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
102     print order.state
103     assert order.state == 'done', "Production should be closed after finished all operations."
104 -
105   I print a Barcode Report of Operation line.
106 -
107   !python {model: mrp_operations.operation.code}: |
108     import netsvc, tools, os
109     (data, format) = netsvc.LocalService('report.mrp.code.barcode').create(cr, uid, [ref('mrp_operations.mrp_op_1'),ref('mrp_operations.mrp_op_2'),ref('mrp_operations.mrp_op_3'),ref('mrp_operations.mrp_op_4'),ref('mrp_operations.mrp_op_5')], {}, {})
110     if tools.config['test_report_directory']:
111         file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
112
113 -
114   I print Workcenter's Barcode Report.
115 -
116   !python {model: mrp.workcenter}: |
117     import netsvc, tools, os
118     (data, format) = netsvc.LocalService('report.mrp.wc.barcode').create(cr, uid, [ref('mrp.mrp_workcenter_0'),ref('mrp.mrp_workcenter_1')], {}, {})
119     if tools.config['test_report_directory']:
120         file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)