From 83fb8a6625bc83beedf09d56dc19e074e59f322c Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 24 Feb 2025 16:53:43 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E5=8F=91=E9=80=81=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_message/models/sf_message_stock_picking.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sf_message/models/sf_message_stock_picking.py b/sf_message/models/sf_message_stock_picking.py index 10304cf3..7179a4eb 100644 --- a/sf_message/models/sf_message_stock_picking.py +++ b/sf_message/models/sf_message_stock_picking.py @@ -90,8 +90,10 @@ class SFMessageStockPicking(models.Model): contents.append(content) elif message_queue_id.message_template_id.name == '调拨单质检完成提醒': content = message_queue_id.message_template_id.content - content = content.replace('{{picking_type_name}}', self.picking_type_id.name).replace( - '{{name}}', self.name) + stock_picking_line = self.env['stock.picking'].sudo().search( + [('id', '=', int(message_queue_id.res_id))]) + content = content.replace('{{picking_type_name}}', stock_picking_line.picking_type_id.name).replace( + '{{name}}', stock_picking_line.name) contents.append(content) return contents, message_queue_ids From 7ecb28382ac3170bb3c1b85f4c5489cc8a716e84 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 25 Feb 2025 10:28:51 +0800 Subject: [PATCH 02/10] =?UTF-8?q?1=E3=80=81=E5=BA=93=E5=AD=98=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8F=B7=E7=9A=84=E6=9B=B4=E6=96=B0=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8C=89=E9=92=AE=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B2=E3=80=81=E9=94=80=E5=94=AE=E5=8D=95=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=98=BE=E7=A4=BA=E5=AD=97=E6=AE=B5=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 16 ++-------------- sf_sale/views/sale_order_view.xml | 3 +++ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index e1cf0ee4..9f5a7733 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -713,20 +713,6 @@ class StockPicking(models.Model): 'draft', 'sent']: picking.state = 'waiting' - # def write(self, vals): - # - # old_state = None - # if 'state' in vals: - # old_state = self.state - # res = super(StockPicking, self).write(vals) - # if (self.picking_type_id.use_existing_lots is False and self.picking_type_id.use_create_lots is True and - # (('move_ids_without_package' in vals and self.state == 'assigned') - # or ('state' in vals and vals['state'] == 'assigned' and old_state not in ['assigned', 'done']))): - # if self.move_ids_without_package: - # for move_id in self.move_ids_without_package: - # move_id.action_show_details() - # return res - @api.constrains('state', 'move_ids_without_package') def _check_move_ids_without_package(self): """ @@ -1059,6 +1045,8 @@ class ReStockMove(models.Model): 更新序列号 功能按钮 """ self.move_line_nosuggest_ids.unlink() + if self.state != 'assigned': + self.state = 'assigned' return self.action_show_details() diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index 185050c0..5a6b08de 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -127,6 +127,9 @@ + + hide + hide From 0fd33831f138128f18dda731cc31d51716405d03 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 25 Feb 2025 11:22:41 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=94=B1=E5=AE=A2?= =?UTF-8?q?=E4=BE=9B=E6=96=99=E5=85=A5=E5=BA=93=E5=8D=95=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E8=B4=A8=E6=A3=80=E5=8D=95=E6=B2=A1=E6=9C=89=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E5=BA=8F=E5=88=97=E5=8F=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 10 ++++++---- sf_quality/models/quality.py | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9f5a7733..96a35221 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -455,7 +455,8 @@ class ProductionLot(models.Model): [('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name)], limit=1, order='name desc') move_line_id = self.env['stock.move.line'].sudo().search( - [('product_id', '=', product.id), ('lot_name', 'ilike', product.name)], limit=1, order='lot_name desc') + [('company_id', '=', company.id), ('product_id', '=', product.id), ('lot_name', 'ilike', product.name)], + limit=1, order='lot_name desc') if last_serial or move_line_id: return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name if ( not move_line_id or @@ -899,8 +900,8 @@ class ReStockMove(models.Model): lot_code = '%s-%s-%s' % ('%s-T-DJWL-%s' % ( product.cutting_tool_model_id.code.split('-')[0], product.cutting_tool_material_id.code), datetime.now().strftime("%Y%m%d"), origin) - move_line_ids = self.env['stock.move.line'].sudo().search([('lot_name', 'like', lot_code)], limit=1, - order='id desc') + move_line_ids = self.env['stock.move.line'].sudo().search( + [('company_id', '=', company.id), ('lot_name', 'like', lot_code)], limit=1, order='id desc') if not move_line_ids: lot_code = '%s-001' % lot_code else: @@ -937,7 +938,8 @@ class ReStockMove(models.Model): [('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', origin)], limit=1, order='id DESC') move_line_id = self.env['stock.move.line'].sudo().search( - [('product_id', '=', product.id), ('lot_name', 'ilike', origin)], limit=1, order='lot_name desc') + [('company_id', '=', company.id), ('product_id', '=', product.id), ('lot_name', 'ilike', origin)], + limit=1, order='lot_name desc') split_codes = product.cutting_tool_model_id.code.split('-') if last_serial or move_line_id: return "%s-T-%s-%s-%03d" % ( diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index fb8518e2..ebe30a71 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -40,6 +40,14 @@ class QualityCheck(models.Model): operation_id = fields.Many2one('mrp.routing.workcenter', '作业', store=True, compute='_compute_operation_id') is_inspect = fields.Boolean('需送检', related='point_id.is_inspect') + lot_name = fields.Char('批次/序列号 名称', compute='_compute_lot_name', store=True) + + @api.depends('move_line_id', 'move_line_id.lot_name') + def _compute_lot_name(self): + for qc in self: + if qc.move_line_id: + qc.lot_name = qc.move_line_id.lot_name + @api.depends('point_id.operation_id') def _compute_operation_id(self): for qc in self: From fb4f08a24abb1ada26f14de43a720f173048977a Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 25 Feb 2025 15:05:30 +0800 Subject: [PATCH 04/10] =?UTF-8?q?1=E3=80=81=E5=A4=84=E7=90=86=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E4=BE=9B=E8=B4=A7?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E6=8A=A5=E9=94=99-=E5=9D=AF=E6=96=99?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F=E6=98=AF=E8=87=AA=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=20=E9=97=AE=E9=A2=98=EF=BC=9B2=E3=80=81=E8=B4=A8?= =?UTF-8?q?=E6=A3=80=E5=AE=8C=E6=88=90=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=E6=8E=A5=EF=BC=9B?= =?UTF-8?q?3=E3=80=81=E6=B7=BB=E5=8A=A0=20=E5=BA=93=E5=AD=98=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=8D=95=E6=8D=AE=E6=B2=A1=E6=9C=89=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E5=8D=95=E6=97=B6-=E4=BC=9A=E5=8F=91=E9=80=81=E5=BE=85?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5-?= =?UTF-8?q?=E4=B8=8D=E7=94=A8=E5=8F=91=E9=80=81=E5=88=A4=E6=96=AD=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 4 ++-- sf_message/data/template_data.xml | 2 +- sf_message/models/sf_message_stock_picking.py | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 8bec3e65..04d4b2c0 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -774,11 +774,11 @@ class MrpProduction(models.Model): self.ensure_one() iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[ 'ir.sequence'].next_by_code('stock.lot.serial') - iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code) + # iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code) self.lot_producing_id = self.env['stock.lot'].create({ 'product_id': self.product_id.id, 'company_id': self.company_id.id, - 'name': iot_code_name, + 'name': iot_code, }) if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids: self.move_finished_ids.filtered( diff --git a/sf_message/data/template_data.xml b/sf_message/data/template_data.xml index 4d580127..63e51101 100644 --- a/sf_message/data/template_data.xml +++ b/sf_message/data/template_data.xml @@ -262,7 +262,7 @@ markdown normal ### {{picking_type_name}}待处理提醒: -单号:{{name}} +单号:[{{name}}]({{request_url}}) 事项:质量检查已完成 diff --git a/sf_message/models/sf_message_stock_picking.py b/sf_message/models/sf_message_stock_picking.py index 7179a4eb..b469e88c 100644 --- a/sf_message/models/sf_message_stock_picking.py +++ b/sf_message/models/sf_message_stock_picking.py @@ -51,7 +51,8 @@ class SFMessageStockPicking(models.Model): all_ready_or_done = all(picking.state in ['assigned', 'done'] for picking in stock_picking_list) if all_ready_or_done: mrp_production.add_queue('工序外协发料通知') - if all(qc.quality_state in ['pass', 'fail'] for qc in record.quality_check_ids): + if record.quality_check_ids and all( + qc.quality_state in ['pass', 'fail'] for qc in record.quality_check_ids): record.add_queue('调拨单质检完成提醒') except Exception as e: logging.info('add_queue_compute_state error:%s' % e) @@ -92,8 +93,12 @@ class SFMessageStockPicking(models.Model): content = message_queue_id.message_template_id.content stock_picking_line = self.env['stock.picking'].sudo().search( [('id', '=', int(message_queue_id.res_id))]) + url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + action_id = self.env.ref('stock.action_picking_tree_ready').id + menu_id = self.env.ref('stock.menu_stock_root').id + url_with_id = f"{url}/web#view_type=form&action={action_id}&menu_id={menu_id}&id={stock_picking_line.id}" content = content.replace('{{picking_type_name}}', stock_picking_line.picking_type_id.name).replace( - '{{name}}', stock_picking_line.name) + '{{name}}', stock_picking_line.name).replace('{{request_url}}', url_with_id) contents.append(content) return contents, message_queue_ids From 3cd7a52900a204d5d6537d244229ebb99c209cea Mon Sep 17 00:00:00 2001 From: hyyy <123@qq.com> Date: Tue, 25 Feb 2025 16:15:11 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=8E=BB=E6=8E=89listRenderer=E5=90=AB?= =?UTF-8?q?=E6=9C=89hasSelectors=E6=97=B6=E7=9A=84row=5Fno=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E4=B8=BAtd=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=BA=8F?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_frontend/static/src/views/list_nums/list_nums.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jikimo_frontend/static/src/views/list_nums/list_nums.xml b/jikimo_frontend/static/src/views/list_nums/list_nums.xml index d2ad6824..6dee30bd 100644 --- a/jikimo_frontend/static/src/views/list_nums/list_nums.xml +++ b/jikimo_frontend/static/src/views/list_nums/list_nums.xml @@ -4,9 +4,9 @@ - + From 2e648dea4e7143cf2efc94e20c1aadffc3ea3fef Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:29:58 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=88=90=E5=93=81=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E5=B7=B2=E7=BB=8F=E5=AE=8C=E6=88=90-=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E8=BF=98=E6=9C=89=E3=80=90=E5=9B=9E=E9=80=80=E3=80=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE-=E8=BF=98=E8=83=BD=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E6=88=90=E5=8A=9F=20=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/stock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9f5a7733..0156fa81 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -645,6 +645,16 @@ class StockPicking(models.Model): stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel")) if sale_id and not stock_picking: sale_id.write({'state': 'delivered'}) + if self.location_dest_id.name == '成品存货区' and self.state == 'done': + for move in self.move_ids: + for production in self.sale_order_id.mrp_production_ids: + moves = self.env['stock.move'].search([ + ('name', '=', production.name), + ('state', '!=', 'cancel') + ]) + finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None) + if finish_move.id in move.move_orig_ids.ids and finish_move.state == 'done': + production.workorder_ids.write({'back_button_display': False}) return res # 创建 外协出库入单 From a0c5f9d15fb38ba5a3a65a6dc7fc6fd115425b21 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:31:18 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=98=AF=E8=BF=94=E5=B7=A5=E7=8A=B6=E6=80=81=E6=97=B6-?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E8=BF=94=E5=B7=A5=E7=9A=84=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=9C=89=E3=80=90=E5=9B=9E=E9=80=80=E3=80=91=E5=85=A5=E5=8F=A3?= =?UTF-8?q?-=E8=A6=81=E9=9A=90=E8=97=8F=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 9a7c949d..f65897d7 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -103,7 +103,11 @@ class ResMrpWorkOrder(models.Model): record.back_button_display = True else: record.back_button_display = False - if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹': + # tag_type + if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any( + detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工' + for detection_result in cur_workorder.production_id.detection_result_ids + ): record.back_button_display = False else: next_workorder = sorted_workorders[position + 1] @@ -113,7 +117,10 @@ class ResMrpWorkOrder(models.Model): record.back_button_display = True else: record.back_button_display = False - if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹': + if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any( + detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工' + for detection_result in cur_workorder.production_id.detection_result_ids + ): record.back_button_display = False date_planned_start = fields.Datetime(tracking=True) From 7975fd2bd29b0bcce6872b2e3d6f818302a08ecf Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:32:04 +0800 Subject: [PATCH 08/10] =?UTF-8?q?CNC=E5=9B=9E=E9=80=80=E5=90=8E=E9=9C=80?= =?UTF-8?q?=E5=BC=80=E6=94=BE=E9=80=81=E6=A3=80=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/mrp_workorder_view.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index bd94e9c9..ff6b0a20 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -202,10 +202,11 @@ attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>