Merge pull request !8607 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-02-03 11:33:35 +00:00
committed by Gitee
4 changed files with 79 additions and 17 deletions
@@ -989,7 +989,7 @@ class SoongWorkflowMixin(models.AbstractModel):
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += "or not is_end"
invisible += " or not is_end"
if button.name == "退回":
btn_exec_action_el.set("class", "btn btn-return")
id_el = etree.Element("field")
+12 -13
View File
@@ -301,11 +301,6 @@ class HrContract(models.Model):
else: # operator == '!='
return [("company_id", "not in", company_ids)]
# @api.onchange('resource_calendar_id')
# def _onchange_resource_calendar_id(self):
# if self.resource_calendar_id:
# self.employee_id.sudo().write({'resource_calendar_id': self.resource_calendar_id.id})
@api.depends("contract_type_id")
def _compute_simplified_name(self):
for record in self:
@@ -322,17 +317,21 @@ class HrContract(models.Model):
@api.depends("contract_type_id")
def _compute_name(self):
for record in self:
has_copy_suffix = "(副本)" in (record.name or "")
if record.contract_type_id and record.employee_id:
record.name = (
record.employee_id.name + record.contract_type_id.name + "合同"
)
new_name = record.employee_id.name + record.contract_type_id.name + "合同"
else:
record.name = " "
new_name = " "
if has_copy_suffix:
record.name = new_name + "(副本)"
else:
record.name = new_name
if record.contract_type_id:
if record.contract_type_id.name == "实习协议":
record.is_internship = True
else:
record.is_internship = False
record.is_internship = record.contract_type_id.name == "实习协议"
else:
record.is_internship = False
def action_hr_contract(self):
return {
+63 -3
View File
@@ -592,9 +592,67 @@ class IssueLibrary(models.Model):
issue = self.env["issue.library"].browse(self.id)
if issue.issue_state != 'will':
raise UserError("当前状态不允许上会")
issue_details = [(0, 0, {
'issue_library_id': issue.id,
})]
current_user = self.env.user
user_company_name = current_user.company_id.name if current_user.company_id else ""
issue_details = []
target_meeting_type_id = False
meeting_priority = [
('is_party', 'is_party_passed', None), # 党总支:动态匹配名称(集团本部=党总支/其他=党支委)
('is_class', 'is_class_passed', '班子'), # 班子会:匹配含「班子」的名称
('is_boss', 'is_boss_passed', '董事'), # 董事会:匹配含「董事」的名称
]
def get_all_sub_departments(department):
dept_ids = [department.id]
sub_depts = self.env['hr.department'].search([('parent_id', '=', department.id)])
for sub_dept in sub_depts:
dept_ids += get_all_sub_departments(sub_dept)
return dept_ids
all_dept_ids = get_all_sub_departments(self.department_id)
target_employees = self.env['hr.employee'].search([
('department_id', 'in', all_dept_ids),
('active', '=', True)
])
manager_employee = self.env['hr.employee'].search([
('id', 'in', target_employees.ids),
('user_role_id.name', '=', '部门经理')
], limit=1)
for issue in self:
issue_details.append((0, 0, {
'issue_library_id': issue.id,
'employee_id': manager_employee.id,
'designated_person_ids': [(6, 0, target_employees.ids)],
}))
if target_meeting_type_id:
continue
# 按「党→班子→董事」优先级匹配
for idx, (field_flag, field_passed, keyword) in enumerate(meeting_priority):
# 跳过未勾选的会议类型
if not getattr(issue, field_flag, False):
continue
passed_result = getattr(issue, field_passed, '')
# 逻辑:空/未通过 → 匹配对应会议类型;已通过 → 继续匹配下一级
if passed_result in (False, 'reject'):
if idx == 0:
if user_company_name == "集团本部":
party_meeting_name = "党总支"
else:
party_meeting_name = "党支委"
meeting_type = self.env['room.meeting.type'].search([
('name', 'ilike', party_meeting_name)
], limit=1)
else:
meeting_type = self.env['room.meeting.type'].search([
('name', 'ilike', keyword)
], limit=1)
if meeting_type:
target_meeting_type_id = meeting_type.id
break
elif passed_result == 'pass':
continue
form_id = self.env.ref("room.room_booking_view_form").id
return {
"type": "ir.actions.act_window",
@@ -604,6 +662,8 @@ class IssueLibrary(models.Model):
"context": {
'default_is_issue': True,
'default_state': '申请人',
'default_meeting_type_id': target_meeting_type_id,
'default_start_datetime': fields.Datetime.now() + timedelta(hours=8),
'default_issue_meeting_line_ids': issue_details,
}
}
@@ -341,6 +341,7 @@
<field name="issue_state"/>
<field name="company_id" optional="hide"/>
<button name="single_meeting_issue" string="上会" type="object" class="oe_highlight" invisible="issue_state != 'will'"/>
<button name="meeting_record" string="会议详情" type="object" class="oe_highlight" invisible="issue_state not in ['meeting', 'on_meet']"/>
<button name="correction" string="修正" type="object" class="oe_highlight"/>
<button name="issue_cancel" string="取消" type="object" class="oe_highlight"/>
<button name="unlink" string="删除" type="object" class="oe_highlight"/>
@@ -500,6 +501,7 @@
<field name="issue_state"/>
<field name="company_id" optional="hide"/>
<button name="single_meeting_issue" string="上会" type="object" class="oe_highlight" invisible="issue_state != 'will'"/>
<button name="meeting_record" string="会议详情" type="object" class="oe_highlight" invisible="issue_state not in ['meeting', 'on_meet']"/>
<button name="correction" string="修正" type="object" class="oe_highlight"/>
<button name="issue_cancel" string="取消" type="object" class="oe_highlight"/>
<button name="unlink" string="删除" type="object" class="oe_highlight"/>
@@ -647,6 +649,7 @@
<field name="issue_state"/>
<field name="company_id" optional="hide"/>
<button name="single_meeting_issue" string="上会" type="object" class="oe_highlight" invisible="issue_state != 'will'"/>
<button name="meeting_record" string="会议详情" type="object" class="oe_highlight" invisible="issue_state not in ['meeting', 'on_meet']"/>
<button name="correction" string="修正" type="object" class="oe_highlight"/>
<button name="issue_cancel" string="取消" type="object" class="oe_highlight"/>
<button name="unlink" string="删除" type="object" class="oe_highlight"/>