2 I compute the production order.
4 !python {model: mrp.production}: |
5 order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
6 order.action_compute(context=context)
8 I check planned date in workcenter lines of production order.
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)
18 I confirm the Production Order.
20 !workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_shelf100cm}
24 !python {model: procurement.order}: |
25 self.run_scheduler(cr, uid)
27 I forcefully close internal shipment.
29 !python {model: mrp.production}: |
30 self.force_production(cr, uid, [ref("mrp.mrp_production_shelf100cm")])
34 !workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_shelf100cm}
36 Production start on first work center, so I start work operation on first work center.
38 !python {model: mrp.production}: |
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)
44 Now I pause first work operation due to technical fault of work center.
46 !python {model: mrp.production}: |
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)
53 I resume first work operation.
55 !python {model: mrp.production}: |
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)
62 I cancel first work operation.
64 !python {model: mrp.production}: |
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)
70 I reset first work operation and start after resolve techninal fault of work center.
72 !python {model: mrp.production}: |
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)
79 Now Finished work of first work operation so I close that operation.
81 !python {model: mrp.production}: |
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)
87 Now I close other operations after start one by one.
89 !python {model: mrp.production}: |
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)
98 I check that the production order is now done.
100 !python {model: mrp.production}: |
101 order = self.browse(cr, uid, ref("mrp.mrp_production_shelf100cm"), context=context)
103 assert order.state == 'done', "Production should be closed after finished all operations."
105 I print a Barcode Report of Operation line.
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)
114 I print Workcenter's Barcode Report.
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)