扫码执行一键合并下发按钮已完成
This commit is contained in:
@@ -3,13 +3,18 @@
|
||||
<record id="sf_install_the_tray_workorder_form_view__scan_barcode" model="ir.ui.view">
|
||||
<field name="name">sf.install.the.tray.workorder.form.scan.barcode</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<!-- <field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <xpath expr="//page//field[@name='tray_code']" position="before"> -->
|
||||
<!-- --><!-- invisible="1" -->
|
||||
<!-- <field name="_barcode_scanned" widget="barcode_handler" string="扫码"/> -->
|
||||
<!-- </xpath> -->
|
||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page//field[@name='tray_code']" position="before">
|
||||
<xpath expr="//group//field[@name='processing_panel']" position="after">
|
||||
<!-- invisible="1" -->
|
||||
<field name="_barcode_scanned" widget="barcode_handler" string="扫码"/>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -561,21 +561,48 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
def on_barcode_scanned(self, barcode):
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
if "*" not in barcode:
|
||||
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
self.tray_code = tray_code.code
|
||||
self.tray_id = workorder.gettray_auto(barcode)
|
||||
if self.routing_type == '装夹':
|
||||
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
self.tray_code = tray_code.code
|
||||
self.tray_id = workorder.gettray_auto(barcode)
|
||||
elif self.routing_type == '前置三元定位检测':
|
||||
print('我是前置三元检测')
|
||||
logging.info('我是前置三元检测')
|
||||
elif self.routing_type == 'CNC加工':
|
||||
if barcode == 'UP-ALL':
|
||||
print("我是一键合并下发")
|
||||
logging.info('我是一键合并下发')
|
||||
self.up_merge_all()
|
||||
else:
|
||||
print('CNC加工')
|
||||
# print(barcode)
|
||||
# a = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
# print(a)
|
||||
# # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)], limit=1)
|
||||
# workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)])
|
||||
# e = workorder_obj.id
|
||||
# print(workorder_obj)
|
||||
# action = {
|
||||
# 'name': '工单',
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# # 'view_type': 'form',
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'mrp.workorder',
|
||||
# 'view_id': self.env.ref('mrp.mrp_production_workorder_form_view_inherit').id,
|
||||
# # 'res_id': workorder_obj.id,
|
||||
# 'res_id': 1023,
|
||||
# 'target': 'current',
|
||||
# # 'context': self.env.context,
|
||||
# # 'flags': {'initial_mode': 'edit'},
|
||||
# }
|
||||
# return action
|
||||
|
||||
elif self.routing_type == '后置三元质量检测':
|
||||
print('后置三元检测')
|
||||
elif self.routing_type == '解除装夹':
|
||||
print("我是解除装夹")
|
||||
else:
|
||||
pass
|
||||
|
||||
else:
|
||||
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||
|
||||
|
||||
|
||||
# return {
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'name': '工单',
|
||||
# 'res_model': 'mrp.workorder',
|
||||
# 'view_mode': 'form',
|
||||
# 'context': {'active_id': self.id},
|
||||
# # 'target': 'current',
|
||||
# }
|
||||
|
||||
|
||||
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||
Reference in New Issue
Block a user