From 1f24e1ebf9223da0f992ad13e8a71cb7ce6254ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Fri, 27 Mar 2026 17:45:30 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
soong_workflow/models/soong_workflow_mixin.py | 17 ++++++++++++++++-
soong_workflow/models/soong_workflow_record.py | 18 ++++++++++++++++++
soong_workflow/views/soong_workflow_record.xml | 1 +
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index e31fac65d..1299b7253 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -39,6 +39,14 @@ class SoongWorkflowMixin(models.AbstractModel):
# setattr(record, field, value)
# return res
+ def write(self, vals):
+ if self._context.get('_correction_skip'):
+ return super(SoongWorkflowMixin, self).write(vals)
+ for record in self:
+ if record.is_modify:
+ record._write({'is_modify': False})
+ return super(SoongWorkflowMixin, self).write(vals)
+
@api.model
def _compute_default_state(self):
# Objects
@@ -72,6 +80,7 @@ class SoongWorkflowMixin(models.AbstractModel):
track_visibility="onchange",
store=True
)
+ is_modify = fields.Boolean(string="可修改")
workflow_id = fields.Many2one(
comodel_name="soong.workflow",
string="Workflow Ref.",
@@ -1233,6 +1242,11 @@ class SoongWorkflowMixin(models.AbstractModel):
done_el.set("invisible", "1")
header_el.append(done_el)
+ modify_el = etree.Element("field")
+ modify_el.set("name", "is_modify")
+ modify_el.set("invisible", "1")
+ header_el.append(modify_el)
+
if header_el is not False:
state_el = etree.Element("field")
state_el.set("name", "state")
@@ -1425,7 +1439,8 @@ class SoongWorkflowMixin(models.AbstractModel):
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
- field_inst.set("readonly", "state in %s" % readonly_arr)
+ if readonly_arr:
+ field_inst.set("readonly", "(state in %s) and (is_modify != True)" % readonly_arr)
# if required_arr:
# field_inst.set("required", "state in %s" % required_arr)
if invisible_arr:
diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py
index d304aaa8c..e0df1fc74 100644
--- a/soong_workflow/models/soong_workflow_record.py
+++ b/soong_workflow/models/soong_workflow_record.py
@@ -109,6 +109,24 @@ class SoongWorkflowRecord(models.Model):
store=False,
)
+ def correction(self):
+ for rec in self:
+ biz_record = self.env[rec.res_model].browse(rec.res_id)
+ if hasattr(biz_record, 'user_id') and biz_record.user_id:
+ employee = biz_record.user_id.employee_ids
+ elif hasattr(biz_record, 'users_id') and biz_record.users_id:
+ employee = biz_record.users_id.employee_ids
+ menu_id = self.env['ir.ui.menu'].search([('name', '=', '已办流程')])
+ url = f'https://oa.thtzjt.com/web#id={rec.res_id}&cids=2&action={menu_id.action.id}&model={rec.res_model}&view_type=list&menu_id={menu_id.id}'
+ self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa',
+ user_id=employee.wecom_userid,
+ title="流程修正",
+ description=f"您有一条流水号为【{rec.code}】标题为【{rec.name}】流程待修正,请尽快修正",
+ url=url, btntxt="详细信息")
+ record = self.env[rec.res_model].sudo().browse(rec.res_id).exists()
+ record = record.with_context(_correction_skip=True)
+ record.is_modify = True
+
@api.returns('self', lambda value: value.id)
def copy(self, default=None):
default = default or {}
diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml
index f75c36c9e..2128e07d7 100644
--- a/soong_workflow/views/soong_workflow_record.xml
+++ b/soong_workflow/views/soong_workflow_record.xml
@@ -121,6 +121,7 @@
+