From d47a30977c74c136f16ddef500cb25ea13f6f0b6 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 10:24:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=B7=B2=E5=BD=92=E6=A1=A3=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E5=B7=A5=E8=89=BA=E5=8F=AF=E9=80=89=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=8D=E8=BF=9B=E8=A1=8C=E4=BA=A7=E5=93=81=E5=88=9B?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_dlm_management/models/sf_production_common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sf_dlm_management/models/sf_production_common.py b/sf_dlm_management/models/sf_production_common.py index 637aeb26..ab232318 100644 --- a/sf_dlm_management/models/sf_production_common.py +++ b/sf_dlm_management/models/sf_production_common.py @@ -24,6 +24,8 @@ class SfProductionProcessParameter(models.Model): obj = super(SfProductionProcessParameter, self).create(vals) return obj def create_service_product(self): + if not self.active: + return service_categ = self.env.ref( 'sf_dlm.product_category_surface_technics_sf').sudo() From 36a13c04deb79269a337d9abeee264704afdc86d Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 10:55:21 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=8E=E4=BA=A7=E5=93=81=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index b9d75545..e8dd3b10 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -928,6 +928,8 @@ class MrpProduction(models.Model): 'sf_stock.stock_route_process_outsourcing').id)] for product_id, request_line_list in grouped_purchase_request_line_sorted_list.items(): cur_request_line = request_line_list[0] + if cur_request_line['product_qty'] == 1: + cur_request_line['product_qty'] = len(request_line_list) # cur_request_line['product_qty'] = cur_request_line['product_qty'] cur_request_line['request_id'] = pr.id cur_request_line['origin'] = ", ".join({item['production_name'] for item in request_line_list if item.get('production_name')}) From 1040844b0a7a50f7194c6a298225fecb0830fe44 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 11:01:51 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_request/models/mrp_production.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/jikimo_purchase_request/models/mrp_production.py b/jikimo_purchase_request/models/mrp_production.py index 58a94eba..5c86947f 100644 --- a/jikimo_purchase_request/models/mrp_production.py +++ b/jikimo_purchase_request/models/mrp_production.py @@ -29,14 +29,6 @@ class MrpProduction(models.Model): 采购请求 """ self.ensure_one() - # pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name),('is_subcontract', '!=', True)]) - # if self.product_id.product_tmpl_id.single_manufacturing == True and not self.is_remanufacture: - # first_order = self.env['mrp.production'].search( - # [('origin', '=', self.origin), ('product_id', '=', self.product_id.id)], limit=1, order='id asc') - # pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_order.name)]) - # else: - # pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name)]) - # 由于采购申请合并了所有销售订单行的采购,所以不区分产品 first_mp = self.env['mrp.production'].search( [('origin', '=', self.origin)], limit=1, order='id asc') pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_mp.name)]) @@ -54,7 +46,7 @@ class MrpProduction(models.Model): else: action.update({ 'name': _("从 %s生成采购请求单", self.name), - 'domain': [('id', 'in', pr_ids)], + 'domain': [('id', 'in', pr_ids.ids)], 'view_mode': 'tree,form', }) return action From 89e23050e6f80b5b83f6ea1e8bf5a262a5b9a22b Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 14:54:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=89=93=E5=8D=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=A0=86=E6=A0=88=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_mrs_connect/controllers/controllers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index a5d8d7c7..27c24c7a 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -3,6 +3,9 @@ import logging import os import json import base64 +import traceback + + from odoo import http, fields, models from odoo.http import request from odoo.addons.sf_base.controllers.controllers import MultiInheritController @@ -273,7 +276,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): except Exception as e: res = {'status': -1, 'message': '系统解析失败'} request.cr.rollback() - logging.info('get_cnc_processing_create error:%s' % e) + traceback_error = traceback.format_exc() + logging.error("get_cnc_processing_create error:%s" % traceback_error) return json.JSONEncoder().encode(res) From ed50d7c9a798453c46ebc3cf00eb2527dbf609e5 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 12 May 2025 14:55:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B0=83=E6=8B=A8=E5=8D=95=E5=B0=B1?= =?UTF-8?q?=E7=BB=AA=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 5 ++--- sf_manufacturing/models/purchase_order.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 35cd2234..df303c9c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1312,6 +1312,7 @@ class ResMrpWorkOrder(models.Model): else: workorder.state = 'ready' continue + continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' or workorder.production_id.schedule_state != '已排' @@ -1327,9 +1328,7 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: - if len(workorder.production_id.picking_ids.filtered( - lambda w: w.state not in ['done', - 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': + if workorder.production_id.programming_state == '已编程': purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: if purchase_orders_id.state == 'purchase': diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index 8fbd6c9d..d73e3f03 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -152,6 +152,8 @@ class PurchaseOrder(models.Model): for line in self.order_line: # 将产品不追踪序列号的行项目设置qty_done + if not line.move_ids: + continue if line.move_ids[0].product_id.tracking == 'none': line.move_ids[0].quantity_done = line.move_ids[0].product_qty return res