From 9ec37f5d5b359538eaa8dfc73d3e709af96576f7 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 3 Jul 2024 09:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=9D=A2=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E4=BA=A7=E7=BA=BF=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 24 +++++++++---------- sf_manufacturing/models/mrp_workorder.py | 5 ++-- .../views/mrp_production_addional_change.xml | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index dd97531f..fde6814b 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -229,12 +229,12 @@ class Manufacturing_Connect(http.Controller): # request.env['sf.production.plan'].sudo().search([('production_id', '=', production_id)]).write( # {'actual_end_time': workorder.date_finished, # 'state': 'finished'}) - # production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)]) - # if production_obj: - # production_obj.sudo().work_order_state = '已完成' - # production_obj.write({'state': 'done'}) - # request.env['sale.order'].sudo().search( - # [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'}) + # production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)]) + # if production_obj: + # production_obj.sudo().work_order_state = '已完成' + # production_obj.write({'state': 'done'}) + # request.env['sale.order'].sudo().search( + # [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'}) except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} @@ -471,10 +471,10 @@ class Manufacturing_Connect(http.Controller): workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') if workorder: for order in workorder: - if order.production_id.production_line_state == '待上产线': + if order.production_line_state == '待上产线': logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已上产线'}) + '制造订单产线状态:%s' % order.production_line_state) + order.write({'production_line_state': '已上产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '上产线'), @@ -528,10 +528,10 @@ class Manufacturing_Connect(http.Controller): workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') if workorder: for order in workorder: - if order.production_id.production_line_state == '已上产线': + if order.production_line_state == '已上产线': logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已下产线'}) + '制造订单产线状态:%s' % order.production_line_state) + order.write({'production_line_state': '已下产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '下产线'), diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 09bde519..46bcde47 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -193,8 +193,9 @@ class ResMrpWorkOrder(models.Model): production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id', string='生产线', store=True, tracking=True) - production_line_state = fields.Selection(related='production_id.production_line_state', - string='上/下产线', store=True, tracking=True) + production_line_state = fields.Selection( + [('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')], + string='上/下产线', default='待上产线', tracking=True) detection_report = fields.Binary('检测报告', readonly=True) is_remanufacture = fields.Boolean(string='重新生成制造订单', default=False) is_fetchcnc = fields.Boolean(string='重新获取NC程序', default=False) diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index b65dfb2f..b5e348b9 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -87,7 +87,7 @@ - +