@@ -411,6 +411,9 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
is_logged_company = fields.Boolean('本公司')
|
||||
is_logged_group = fields.Boolean('本集团')
|
||||
|
||||
is_dep = fields.Boolean('部门')
|
||||
role_id = fields.Many2one(comodel_name="soong.user.role", string="角色")
|
||||
|
||||
@api.onchange('is_automatic')
|
||||
def _onchange_is_automatic(self):
|
||||
if self.is_automatic:
|
||||
@@ -418,6 +421,7 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic_group = False
|
||||
self.is_logged_by = False
|
||||
self.is_logged_company = False
|
||||
self.is_dep = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@api.onchange('is_automatic_company')
|
||||
@@ -426,6 +430,7 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic = False
|
||||
self.is_automatic_group = False
|
||||
self.is_logged_by = False
|
||||
self.is_dep = False
|
||||
self.is_logged_company = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@@ -435,6 +440,7 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic = False
|
||||
self.is_automatic_company = False
|
||||
self.is_logged_by = False
|
||||
self.is_dep = False
|
||||
self.is_logged_company = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@@ -444,6 +450,7 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic = False
|
||||
self.is_automatic_company = False
|
||||
self.is_automatic_group = False
|
||||
self.is_dep = False
|
||||
self.is_logged_company = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@@ -454,6 +461,7 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic_company = False
|
||||
self.is_automatic_group = False
|
||||
self.is_logged_by = False
|
||||
self.is_dep = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@api.onchange('is_logged_group')
|
||||
@@ -463,8 +471,19 @@ class SoongWorkflowNodeButton(models.Model):
|
||||
self.is_automatic_company = False
|
||||
self.is_automatic_group = False
|
||||
self.is_logged_by = False
|
||||
self.is_dep = False
|
||||
self.is_logged_company = False
|
||||
|
||||
@api.onchange('is_dep')
|
||||
def _onchange_is_dep(self):
|
||||
if self.is_dep:
|
||||
self.is_automatic = False
|
||||
self.is_automatic_company = False
|
||||
self.is_automatic_group = False
|
||||
self.is_logged_by = False
|
||||
self.is_logged_company = False
|
||||
self.is_logged_group = False
|
||||
|
||||
@api.onchange('users_role_id', 'users_role_group_ids')
|
||||
def _onchange_role_selection(self):
|
||||
if self.users_role_id and self.users_role_group_ids:
|
||||
|
||||
@@ -179,15 +179,21 @@
|
||||
</group>
|
||||
</group>
|
||||
<group/>
|
||||
<group string="按当前申请人自动匹配">
|
||||
<field name="is_automatic" string="本部门"/>
|
||||
<field name="is_automatic_company"/>
|
||||
<field name="is_automatic_group"/>
|
||||
</group>
|
||||
<group string="按当前登录人自动匹配">
|
||||
<field name="is_logged_by" string="本部门"/>
|
||||
<field name="is_logged_company"/>
|
||||
<field name="is_logged_group"/>
|
||||
<group col="3">
|
||||
<group string="按当前申请人自动匹配">
|
||||
<field name="is_automatic" string="本部门"/>
|
||||
<field name="is_automatic_company"/>
|
||||
<field name="is_automatic_group"/>
|
||||
</group>
|
||||
<group string="按当前登录人自动匹配">
|
||||
<field name="is_logged_by" string="本部门"/>
|
||||
<field name="is_logged_company"/>
|
||||
<field name="is_logged_group"/>
|
||||
</group>
|
||||
<group string="按指定部门匹配">
|
||||
<field name="is_dep"/>
|
||||
<field name="role_id" invisible="not is_dep" required="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
||||
@@ -196,6 +196,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
is_logged_by = button.is_logged_by
|
||||
is_logged_company = button.is_logged_company
|
||||
is_logged_group = button.is_logged_group
|
||||
is_dep = button.is_dep
|
||||
|
||||
if button.reviewer_id:
|
||||
employee = self.env['hr.employee'].search([
|
||||
@@ -206,6 +207,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
# 部门和公司筛选条件
|
||||
department_domain = []
|
||||
company_domain = []
|
||||
user_role_domain = []
|
||||
|
||||
if record_id:
|
||||
# 获取当前用户和申请人的相关信息
|
||||
@@ -239,6 +241,13 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
group_company_ids = self.env['res.company'].search([('id', 'child_of', parent_company.id)]).ids
|
||||
company_domain = [('company_id', 'in', group_company_ids)]
|
||||
|
||||
elif is_dep and hasattr(record_id, 'department_id1') and record_id.department_id1:
|
||||
department_id1 = record_id.department_id1.id
|
||||
department_domain = ['|', ('department_id', '=', department_id1.id),
|
||||
('department_ids', 'in', department_id1.id)]
|
||||
user_role_domain = ['|', ('user_role_id', '=', button.role_id.id),
|
||||
('user_role_ids', 'in', button.role_id.id)]
|
||||
|
||||
elif is_logged_by and current_user.department_id:
|
||||
# 按当前登录人自动匹配-本部门(保留部门和公司条件)
|
||||
department_domain = ['|', ('department_id', '=', current_user.department_id.id),
|
||||
@@ -257,14 +266,18 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
group_company_ids = self.env['res.company'].search([('id', 'child_of', parent_company.id)]).ids
|
||||
company_domain = [('company_id', 'in', group_company_ids)]
|
||||
|
||||
# 角色筛选
|
||||
if link_users_id:
|
||||
role_domain = ['|', ('user_role_id', '=', link_users_id.id), ('user_role_ids', 'in', link_users_id.id)]
|
||||
if user_role_domain:
|
||||
role_domain = ['|'] + role_domain + user_role_domain
|
||||
domain = role_domain + company_domain + department_domain
|
||||
return self.env['hr.employee'].sudo().search(domain)
|
||||
|
||||
elif link_users_group_ids:
|
||||
role_domain = ['|', ('user_role_id', 'in', link_users_group_ids.user_role_ids.ids),
|
||||
('user_role_ids', 'in', link_users_group_ids.user_role_ids.ids)]
|
||||
if user_role_domain:
|
||||
role_domain = ['|'] + role_domain + user_role_domain
|
||||
domain = role_domain + company_domain + department_domain
|
||||
return self.env['hr.employee'].sudo().search(domain)
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ class SoongWorkflowRecordRevokeWizard(models.TransientModel):
|
||||
# 请假审批 -> 删除年假明细
|
||||
self.env['vacation.leave.line'].search([
|
||||
('workflow_record_id', '=', self.record_id.id)
|
||||
|
||||
]).unlink()
|
||||
|
||||
elif model_name == 'overtime.approval':
|
||||
|
||||
Reference in New Issue
Block a user