!9514 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyusen-data/gzth">https://gitee.com/jinan-pengyusen-data/gzth</a> into dev_wang
Merge pull request !9514 from 李鹏宇/dev_wang
This commit is contained in:
@@ -101,6 +101,13 @@ class SoongWorkflowRecord(models.Model):
|
||||
store=True # 存储到数据库,以便用于排序
|
||||
)
|
||||
|
||||
# 流程待办人员:从关联记录的log_ids和log_ids2中取出待办/办理中的审批人,逗号拼接
|
||||
pending_users = fields.Text(
|
||||
string="流程待办人员",
|
||||
compute='_compute_pending_users',
|
||||
store=False,
|
||||
)
|
||||
|
||||
@api.returns('self', lambda value: value.id)
|
||||
def copy(self, default=None):
|
||||
default = default or {}
|
||||
@@ -116,6 +123,37 @@ class SoongWorkflowRecord(models.Model):
|
||||
for record in self:
|
||||
record.display_end_time = record.node_update_time or record.write_date2
|
||||
|
||||
@api.depends('res_model', 'res_id', 'approve_state')
|
||||
def _compute_pending_users(self):
|
||||
for record in self:
|
||||
record.pending_users = ''
|
||||
# 只有审批中状态才显示流程待办人员
|
||||
if record.approve_state != 'pending':
|
||||
continue
|
||||
if not record.res_model or not record.res_id:
|
||||
continue
|
||||
try:
|
||||
target = self.env[record.res_model].browse(record.res_id).exists()
|
||||
if not target:
|
||||
continue
|
||||
names = []
|
||||
# 从log_ids中获取待办/办理中的审批人
|
||||
if hasattr(target, 'log_ids'):
|
||||
for log in target.log_ids:
|
||||
if log.approval_state in ('0', '1') and log.done_by and log.done_by.name:
|
||||
if log.done_by.name not in names:
|
||||
names.append(log.done_by.name)
|
||||
# 从log_ids2中获取待办/办理中的审批人
|
||||
if hasattr(target, 'log_ids2'):
|
||||
for log2 in target.log_ids2:
|
||||
if log2.approval_state in ('0', '1') and log2.done_by and log2.done_by.name:
|
||||
if log2.done_by.name not in names:
|
||||
names.append(log2.done_by.name)
|
||||
record.pending_users = ','.join(names)
|
||||
except Exception as e:
|
||||
_logger.warning(f"Failed to compute pending_users for record {record.id}: {e}")
|
||||
record.pending_users = ''
|
||||
|
||||
@api.depends('res_model', 'res_id')
|
||||
def _compute_urgency_level(self):
|
||||
"""从关联的业务模型中获取urgency_level值"""
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
<field name="approve_state" string="审批状态" widget="badge"
|
||||
decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人"/>
|
||||
<field name="soong_state"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" column_invisible="True"/>
|
||||
<field name="soong_state" column_invisible="True"/>
|
||||
<field name="display_end_time" string="办结时间" optional="show"/>
|
||||
<field name="member_of_department" column_invisible="1"/>
|
||||
<field name="node_id" string="当前节点" column_invisible="1"/>
|
||||
@@ -119,6 +119,7 @@
|
||||
<field name="is_manager" column_invisible="1"/>
|
||||
<field name="meal" column_invisible="1"/>
|
||||
<field name="workflow_happen_date" string="发生日期" column_invisible="1"/>
|
||||
<field name="pending_users" string="流程待办人员" optional="show"/>
|
||||
<button name="backend" type="object" string="后台" class="btn-primary"
|
||||
groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<button name="delete_record" type="object" string="删除" class="btn-primary"
|
||||
@@ -154,8 +155,8 @@
|
||||
<field name="approve_state" string="审批状态" widget="badge"
|
||||
decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人"/>
|
||||
<field name="soong_state"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" column_invisible="True"/>
|
||||
<field name="soong_state" column_invisible="True"/>
|
||||
<field name="display_end_time" string="办结时间" optional="show"/>
|
||||
<field name="member_of_department" column_invisible="1"/>
|
||||
<field name="node_id" string="当前节点" column_invisible="1"/>
|
||||
@@ -170,6 +171,7 @@
|
||||
<field name="is_manager" column_invisible="1"/>
|
||||
<field name="meal" column_invisible="1"/>
|
||||
<field name="workflow_happen_date" string="发生日期" column_invisible="1"/>
|
||||
<field name="pending_users" string="流程待办人员" optional="show"/>
|
||||
<button name="backend" type="object" string="后台" class="btn-primary"
|
||||
groups="soong_workflow.group_soong_workflow_manager"/>
|
||||
<button name="delete_record" type="object" string="删除" class="btn-primary"
|
||||
@@ -196,8 +198,8 @@
|
||||
<field name="name"/>
|
||||
<field name="approve_state" string="审批状态"/>
|
||||
<field name="create_uid" readonly="0"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人"/>
|
||||
<field name="soong_state"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" column_invisible="True"/>
|
||||
<field name="soong_state" column_invisible="True"/>
|
||||
<field name="member_of_department"/>
|
||||
<field name="node_id" string="当前节点"/>
|
||||
</group>
|
||||
@@ -254,7 +256,7 @@
|
||||
decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" class="list_ids_width" column_invisible="1"/>
|
||||
<field name="soong_state"/><field name="display_end_time" string="到达时间" optional="show"/>
|
||||
<field name="soong_state" column_invisible="True"/><field name="display_end_time" string="到达时间" optional="show"/>
|
||||
<field name="is_manager" column_invisible="1"/>
|
||||
<field name="is_unlink" column_invisible="1"/>
|
||||
<field name="is_log2" column_invisible="1"/>
|
||||
@@ -323,8 +325,8 @@
|
||||
<field name="approve_state" string="审批状态" widget="badge"
|
||||
decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" class="list_ids_width"/>
|
||||
<field name="soong_state"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" class="list_ids_width" column_invisible="True"/>
|
||||
<field name="soong_state" column_invisible="True"/>
|
||||
<field name="is_manager" column_invisible="1"/>
|
||||
<field name="is_log2" column_invisible="1"/>
|
||||
<button name="greater_record" type="object" string="更多" class="btn-primary"
|
||||
@@ -356,7 +358,7 @@
|
||||
decoration-danger="approve_state == 'end'" decoration-success="approve_state == 'pending'"/>
|
||||
<field name="create_uid"/>
|
||||
<field name="employee_ids" widget="many2many_tags" string="当前经办人" class="list_ids_width" column_invisible="1"/>
|
||||
<field name="soong_state"/><field name="display_end_time" string="办结时间" optional="show"/>
|
||||
<field name="soong_state" column_invisible="True"/><field name="display_end_time" string="办结时间" optional="show"/>
|
||||
<field name="is_manager" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user