From 6ea811afeda750e7498345b867d391eaba3fd143 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 4 Apr 2023 15:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=80=9A=E8=BF=87=E6=94=B9?= =?UTF-8?q?=E9=80=A0=E5=8E=9F=E7=94=9Fjs=E5=AE=9E=E7=8E=B0=E6=89=AB?= =?UTF-8?q?=E7=A0=81=E8=B7=B3=E8=BD=ACform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/models/ftp_client.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py index 53ff1e9e..9236f86e 100644 --- a/sf_machine_connect/models/ftp_client.py +++ b/sf_machine_connect/models/ftp_client.py @@ -508,12 +508,14 @@ class WorkCenterBarcode(models.Model): print(kwargs) print(barcode) print('111111111111111111111') - workorder_obj = self.env['mrp.workorder'].sudo().search([('tray_code', '=', barcode)]) - workorder_cnc = self.env['mrp.workorder'].sudo().search(['&', ('production_id', '=', workorder_obj.production_id.id), ('name', '=', 'CNC加工')]) + workorder_obj_target = self.env['mrp.workorder'].sudo().search([('tray_code', '=', barcode)]) + workorder_obj_current = self.env['mrp.workorder'].sudo().search([('id', '=', kwargs['current_id'])]) + # workorder_cnc = self.env['mrp.workorder'].sudo().search(['&', ('production_id', '=', workorder_obj.production_id.id), ('name', '=', 'CNC加工')]) + workorder_cnc = self.env['mrp.workorder'].sudo().search(['&', ('production_id', '=', workorder_obj_target.production_id.id), ('name', '=', workorder_obj_current.name)]) print('222222222222222222222222') - if workorder_obj: - print(workorder_obj) - print(workorder_obj.id) + if workorder_obj_target: + print(workorder_obj_target) + print(workorder_obj_target.id) action = { 'name': '工单', 'type': 'ir.actions.act_window', @@ -524,7 +526,7 @@ class WorkCenterBarcode(models.Model): 'view_id': request.env.ref('mrp.mrp_production_workorder_form_view_inherit').id, 'res_id': workorder_cnc.id, 'target': 'current', - 'context': {'id': workorder_obj.id}, + 'context': {'id': workorder_obj_target.id}, # 'flags': {'initial_mode': 'edit'}, } action = {'result': action, 'error': '返回错误'}