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] =?UTF-8?q?1=E3=80=81=E5=A4=84=E7=90=86=E9=94=80=E5=94=AE?=
=?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E4=BE=9B=E8=B4=A7=E8=B7=AF?=
=?UTF-8?q?=E7=BA=BF=E6=8A=A5=E9=94=99-=E5=9D=AF=E6=96=99=E8=8E=B7?=
=?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F=E6=98=AF=E8=87=AA=E5=8A=A0=E5=B7=A5?=
=?UTF-8?q?=20=E9=97=AE=E9=A2=98=EF=BC=9B2=E3=80=81=E8=B4=A8=E6=A3=80?=
=?UTF-8?q?=E5=AE=8C=E6=88=90=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=E6=8E=A5=EF=BC=9B3?=
=?UTF-8?q?=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