2 Create a user as 'MRP User'
4 !record {model: res.users, id: res_mrp_operation_user, view: False}:
5 company_id: base.main_company
9 email: mrp_operation_user@yourcompany.com
11 I added groups for MRP User.
13 !record {model: res.users, id: res_mrp_operation_user}:
16 - stock.group_stock_user
18 In order to test mrp_operations with OpenERP, I refer created production order of PC Assemble SC349
19 with routing - Manual Component's Assembly to test complete production process with respect of workcenter with giving access rights of MRP User.
22 uid: 'res_mrp_operation_user'
24 I compute the production order.
26 !python {model: mrp.production}: |
27 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
28 order.action_compute(context=context)
30 I check planned date in workcenter lines of production order.
32 !python {model: mrp.production}: |
33 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
34 for line in order.workcenter_lines:
35 #TODO: to check start date of next line should be end of date of previous line.
36 assert line.date_planned, "Planned Start date is not computed: %s" %(line)
37 assert line.date_planned_end, "Planned End date is not computed: %s" %(line)
39 I confirm the Production Order.
41 !workflow {model: mrp.production, action: button_confirm, ref: mrp.mrp_production_1}
45 !python {model: procurement.order}: |
46 self.run_scheduler(cr, uid)
48 I forcefully close internal shipment.
50 !python {model: mrp.production}: |
51 self.force_production(cr, uid, [ref("mrp.mrp_production_1")])
55 !workflow {model: mrp.production, action: button_produce, ref: mrp.mrp_production_1}
57 Production start on first work center, so I start work operation on first work center.
59 !python {model: mrp.production}: |
60 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
61 order.workcenter_lines[0].signal_workflow('button_start_working')
63 Now I pause first work operation due to technical fault of work center.
65 !python {model: mrp.production}: |
66 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
67 order.workcenter_lines[0].signal_workflow('button_pause')
69 I resume first work operation.
71 !python {model: mrp.production}: |
72 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
73 order.workcenter_lines[0].signal_workflow('button_resume')
76 I cancel first work operation.
78 !python {model: mrp.production}: |
79 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
80 order.workcenter_lines[0].signal_workflow('button_cancel')
82 I reset first work operation and start after resolving technical fault of work center.
84 !python {model: mrp.production}: |
85 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
86 order.workcenter_lines[0].signal_workflow('button_draft')
87 order.workcenter_lines[0].signal_workflow('button_start_working')
89 I close first work operation as this work center completed its process.
91 !python {model: mrp.production}: |
92 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
93 order.workcenter_lines[0].signal_workflow('button_done')
95 Now I close other operations one by one which are in start state.
97 !python {model: mrp.production}: |
98 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
99 for work_line in order.workcenter_lines[1:]:
100 work_line.signal_workflow('button_start_working')
101 work_line.signal_workflow('button_done')
104 I check that the production order is now done.
106 !python {model: mrp.production}: |
107 order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
108 assert order.state == 'done', "Production should be closed after finished all operations."
110 I print a Barcode Report of Operation line.
112 !python {model: mrp_operations.operation.code}: |
113 from openerp import tools
114 from openerp.report import render_report
116 ref('mrp_operations.mrp_op_1'),
117 ref('mrp_operations.mrp_op_2'),
118 ref('mrp_operations.mrp_op_3'),
119 ref('mrp_operations.mrp_op_4'),
120 ref('mrp_operations.mrp_op_5')
122 data, format = render_report(cr, uid, ids, 'mrp.code.barcode', {})
123 if tools.config['test_report_directory']:
124 file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
127 I print Workcenter's Barcode Report.
129 !python {model: mrp.workcenter}: |
130 from openerp import tools
131 from openerp.report import render_report
132 ids = [ref('mrp.mrp_workcenter_0'), ref('mrp.mrp_workcenter_1')]
133 data, format = render_report(cr, uid, ids, 'mrp.wc.barcode', {})
134 if tools.config['test_report_directory']:
135 file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)