@@ -709,16 +709,16 @@ class IssueLibrary(models.Model):
|
||||
user_company_name = current_user.company_id.name if current_user.company_id else ""
|
||||
action_id = self._context.get('from_action')
|
||||
|
||||
for ras in issue_active_ids:
|
||||
issue_details = []
|
||||
target_meeting_type_id = False
|
||||
issue_details = []
|
||||
target_meeting_type_id = False
|
||||
|
||||
for ras in issue_active_ids:
|
||||
# 会议优先级:党 → 班子 → 董事
|
||||
# 每个元组:(字段名, 会议关键字, 检查函数)
|
||||
# 每个元组:(is_xxx字段, 对应的char字段, 会议关键字, 是否已上会)
|
||||
meeting_priority = [
|
||||
('is_party', '党'), # 先检查党
|
||||
('is_class', '班子'), # 再检查班子
|
||||
('is_boss', '董事'), # 最后检查董事
|
||||
('is_party', 'party_char', '党'),
|
||||
('is_class', 'class_char', '班子'),
|
||||
('is_boss', 'boss_char', '董事'),
|
||||
]
|
||||
|
||||
def get_all_sub_departments(department):
|
||||
@@ -734,24 +734,17 @@ class IssueLibrary(models.Model):
|
||||
('active', '=', True)
|
||||
])
|
||||
|
||||
# 先匹配出最终会议类型
|
||||
# 匹配出最终会议类型
|
||||
for issue in issue_active_ids:
|
||||
if target_meeting_type_id:
|
||||
continue
|
||||
|
||||
for field_flag, keyword in meeting_priority:
|
||||
for idx, (field_flag, char_field, keyword) in enumerate(meeting_priority):
|
||||
if not getattr(issue, field_flag, False):
|
||||
continue
|
||||
|
||||
# ========== 根据会议类型获取对应的 char 字段值 ==========
|
||||
char_value = ''
|
||||
if keyword == '党':
|
||||
char_value = getattr(issue, 'party_char', '') or ''
|
||||
elif keyword == '班子':
|
||||
char_value = getattr(issue, 'class_char', '') or ''
|
||||
elif keyword == '董事':
|
||||
char_value = getattr(issue, 'boss_char', '') or ''
|
||||
|
||||
# 获取对应的 char 字段值
|
||||
char_value = getattr(issue, char_field, '') or ''
|
||||
# 去除 HTML 标签后判断是否有值
|
||||
clean_char = re.sub(r'<[^>]+>', '', char_value).strip()
|
||||
|
||||
@@ -789,6 +782,7 @@ class IssueLibrary(models.Model):
|
||||
if meeting_type:
|
||||
target_meeting_type_id = meeting_type.id
|
||||
break
|
||||
# 如果没有值,继续检查下一个优先级
|
||||
|
||||
# 天河粮储 套会逻辑(保持不变)
|
||||
if len(issue_active_ids) == 2 and all(ras.company_id.name == "天河粮储" for ras in issue_active_ids):
|
||||
@@ -835,6 +829,20 @@ class IssueLibrary(models.Model):
|
||||
'is_sanda': meeting_type_has_dang,
|
||||
}))
|
||||
|
||||
form_id = self.env.ref("room.room_booking_view_form", raise_if_not_found=False)
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "批量上会",
|
||||
"res_model": "room.booking",
|
||||
"views": [[form_id.id, "form"]],
|
||||
"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,
|
||||
},
|
||||
}
|
||||
|
||||
def single_meeting_issue(self):
|
||||
issue = self.env["issue.library"].browse(self.id)
|
||||
|
||||
Reference in New Issue
Block a user