From bb4501c4a058d6e221074387ff1a4818b36fa0c4 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: Tue, 3 Feb 2026 19:03:34 +0800
Subject: [PATCH 1/3] =?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
---
yuthon_contract/models/inherit_hr_contract.py | 10 ++-
yuthon_issue/models/issue_library.py | 66 ++++++++++++++++++-
yuthon_issue/views/issue_library_views.xml | 3 +
3 files changed, 73 insertions(+), 6 deletions(-)
diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py
index 60922c293..bc34f3481 100644
--- a/yuthon_contract/models/inherit_hr_contract.py
+++ b/yuthon_contract/models/inherit_hr_contract.py
@@ -309,10 +309,14 @@ class HrContract(models.Model):
@api.depends("contract_type_id")
def _compute_simplified_name(self):
for record in self:
- if record.contract_type_id and record.employee_id:
- record.name = record.contract_type_id.name + "合同"
+ if "(副本)" in (record.name or ""):
+ core_name = record.name.replace("(副本)", "").strip()
+ record.name = core_name + "(副本)"
else:
- record.name = " "
+ if record.contract_type_id and record.employee_id:
+ record.name = record.contract_type_id.name + "合同"
+ else:
+ record.name = " "
if record.contract_type_id:
if record.contract_type_id.name == "实习协议":
record.is_internship = True
diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py
index 7e96a3df7..aa524a9a6 100644
--- a/yuthon_issue/models/issue_library.py
+++ b/yuthon_issue/models/issue_library.py
@@ -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,
}
}
diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml
index d1e818288..cb36bec32 100644
--- a/yuthon_issue/views/issue_library_views.xml
+++ b/yuthon_issue/views/issue_library_views.xml
@@ -341,6 +341,7 @@
+
@@ -500,6 +501,7 @@
+
@@ -647,6 +649,7 @@
+
From 36f4a726059fcdce4b9cd4936c62678ae1bec2bc 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: Tue, 3 Feb 2026 19:10:02 +0800
Subject: [PATCH 2/3] =?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
---
yuthon_contract/models/inherit_hr_contract.py | 35 ++++++++-----------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py
index bc34f3481..0d979c484 100644
--- a/yuthon_contract/models/inherit_hr_contract.py
+++ b/yuthon_contract/models/inherit_hr_contract.py
@@ -301,22 +301,13 @@ 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:
- if "(副本)" in (record.name or ""):
- core_name = record.name.replace("(副本)", "").strip()
- record.name = core_name + "(副本)"
+ if record.contract_type_id and record.employee_id:
+ record.name = record.contract_type_id.name + "合同"
else:
- if record.contract_type_id and record.employee_id:
- record.name = record.contract_type_id.name + "合同"
- else:
- record.name = " "
+ record.name = " "
if record.contract_type_id:
if record.contract_type_id.name == "实习协议":
record.is_internship = True
@@ -326,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 {
From 8626c6cd5f5529cd3da3059fd7031279d58cd54c 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: Tue, 3 Feb 2026 19:30:20 +0800
Subject: [PATCH 3/3] =?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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index 1cab37a02..17f89cf26 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -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")