!12675 添加功能

Merge pull request !12675 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-08-19 09:13:17 +00:00
committed by Gitee
+18 -1
View File
@@ -1279,7 +1279,24 @@ class SoongWorkflowMixin(models.AbstractModel):
]
# 如果有角色条件,添加到可见性条件中
if role_domain:
allowed_user_ids = self.env['res.users'].search(role_domain).ids
allowed_user_ids = set(self.env['res.users'].search(role_domain).ids)
# 委托补充:角色组内的委托人(如部门经理A)若把流程委托给被委托人(b),
# 被委托人本人未必在该角色组内,也应能看到/操作该按钮
entrust_all = self.env['ir.model'].sudo().search(
[('model', '=', 'entrust.all')], limit=1)
model_rec = self.env['ir.model'].sudo().search(
[('model', '=', model)], limit=1) if model else None
entrusts = self.env['soong.workflow.entrust'].sudo().search([
('is_enable', '=', True),
('entrust_user_id', 'in', list(allowed_user_ids)),
])
for ent in entrusts:
ent_model_ids = ent.model_ids.ids
in_scope = (entrust_all and entrust_all.id in ent_model_ids) or (
model_rec and model_rec.id in ent_model_ids)
if in_scope and ent.entrust_user_id2:
allowed_user_ids.add(ent.entrust_user_id2.id)
allowed_user_ids = list(allowed_user_ids)
invisible += f" or uid not in {allowed_user_ids}"
# 如果有隐藏条件的话,启用隐藏
if button.is_review_invisible and button.invisible_expression: