From 22019bcf0cee3168715de515eda45990c5a4d663 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, 6 Jan 2026 10:57:27 +0800 Subject: [PATCH 01/24] =?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_official/__manifest__.py | 1 + yuthon_official/data/official_type_data.xml | 7 +++ yuthon_official/models/__init__.py | 1 + .../models/yuthon_sub_enterprises.py | 29 +++++++++ yuthon_official/security/ir.model.access.csv | 3 +- yuthon_official/views/official_menus.xml | 6 ++ .../views/yuthon_sub_enterprises_view.xml | 59 +++++++++++++++++++ 7 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 yuthon_official/models/yuthon_sub_enterprises.py create mode 100644 yuthon_official/views/yuthon_sub_enterprises_view.xml diff --git a/yuthon_official/__manifest__.py b/yuthon_official/__manifest__.py index 9710074b8..c95d09112 100644 --- a/yuthon_official/__manifest__.py +++ b/yuthon_official/__manifest__.py @@ -23,6 +23,7 @@ 'views/yuthon_official_incoming_labor_views.xml', 'views/yuthon_official_party_views.xml', 'views/yuthon_file_processing_views.xml', + 'views/yuthon_sub_enterprises_view.xml', 'views/yuthon_official_incoming_party_views.xml', 'views/yuthon_cross_departmental_views.xml', # 'views/inherit_soong_workflow_insector_views.xml', diff --git a/yuthon_official/data/official_type_data.xml b/yuthon_official/data/official_type_data.xml index 0a84f4469..f43029a53 100644 --- a/yuthon_official/data/official_type_data.xml +++ b/yuthon_official/data/official_type_data.xml @@ -1,6 +1,13 @@ + + 文件处理(子企业) + sub_enterprises_code + WZQ%(y)s%(month)s%(day)s + 3 + + 文件处理 file_code diff --git a/yuthon_official/models/__init__.py b/yuthon_official/models/__init__.py index bb777bc64..319fb8c08 100644 --- a/yuthon_official/models/__init__.py +++ b/yuthon_official/models/__init__.py @@ -13,3 +13,4 @@ from . import inherit_room_booking from . import inherit_issue_library from . import yuthon_cross_departmental from . import yuthon_file_processing +from . import yuthon_sub_enterprises diff --git a/yuthon_official/models/yuthon_sub_enterprises.py b/yuthon_official/models/yuthon_sub_enterprises.py new file mode 100644 index 000000000..d0d7aa369 --- /dev/null +++ b/yuthon_official/models/yuthon_sub_enterprises.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models, tools +from odoo.exceptions import ValidationError, UserError + + +class YuthonSubEnterprises(models.Model): + _name = 'yuthon.sub.enterprises' + _description = '文件处理(子企业)' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin'] + _rec_name = 'name' + + + name = fields.Char(string="名称") + code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('sub_enterprises_code')) + users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) + company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司") + department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") + come_file_id = fields.Char(string="来文编号") + reason_application = fields.Text(string="事由") + official_partner_id = fields.Many2one('official.partner', string="来文单位") + document_ids = fields.Many2many('ir.attachment', string="附件") + urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', + default='normal') + work_end = fields.Boolean(string="结束") + def _get_default_name_title(self): + return self._description if self._description else self._name + + name_title = fields.Char(default=_get_default_name_title) + self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) diff --git a/yuthon_official/security/ir.model.access.csv b/yuthon_official/security/ir.model.access.csv index 138428166..e8c4922f3 100644 --- a/yuthon_official/security/ir.model.access.csv +++ b/yuthon_official/security/ir.model.access.csv @@ -10,4 +10,5 @@ access_yuthon_official_incoming_normal,yuthon_official_incoming_normal,model_yut access_yuthon_cross_departmental, yuthon_cross_departmental,model_yuthon_cross_departmental,base.group_user,1,1,1,1 access_yuthon_file_processing,yuthon_file_processing,model_yuthon_file_processing,base.group_user,1,1,1,1 access_main_flats,main_flats,model_main_flats,base.group_user,1,1,1,1 -access_copy_flats,copy_flats,model_copy_flats,base.group_user,1,1,1,1 \ No newline at end of file +access_copy_flats,copy_flats,model_copy_flats,base.group_user,1,1,1,1 +access_yuthon_sub_enterprises,yuthon_sub_enterprises,model_yuthon_sub_enterprises,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_official/views/official_menus.xml b/yuthon_official/views/official_menus.xml index fcd007522..660936629 100644 --- a/yuthon_official/views/official_menus.xml +++ b/yuthon_official/views/official_menus.xml @@ -66,6 +66,12 @@ name="工会发文" action="yuthon_official_labor_action" sequence="10"/> + + + + yuthon.sub.enterprises.tree + yuthon.sub.enterprises + + + + + + + + + + + yuthon.sub.enterprises.form + yuthon.sub.enterprises + +
+ + + + + + + + + + + + + +
+

+ +

+
+ + + + + + + + +
+
+
+
+ + 文件处理(子企业) + yuthon.sub.enterprises + tree,form + +
+ From 3a83a882173f3311e946725f2a80d6b64936dca9 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, 6 Jan 2026 11:00:29 +0800 Subject: [PATCH 02/24] =?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_official/views/yuthon_sub_enterprises_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/yuthon_official/views/yuthon_sub_enterprises_view.xml b/yuthon_official/views/yuthon_sub_enterprises_view.xml index 90851e06e..59a4059b3 100644 --- a/yuthon_official/views/yuthon_sub_enterprises_view.xml +++ b/yuthon_official/views/yuthon_sub_enterprises_view.xml @@ -40,6 +40,7 @@ + From b5dba61830318bd61e00885e2d8971c2f4988656 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 11:45:57 +0800 Subject: [PATCH 03/24] 1 --- soong_workflow/wizard/soong_workflow_comment_wizard_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml index 1ff11fbf2..17c941fbe 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml +++ b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml @@ -64,7 +64,7 @@ - + From f7a01078e63e6a6dca4894fa6fa2bddeb2a4fc21 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, 6 Jan 2026 11:52:02 +0800 Subject: [PATCH 04/24] =?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 --- .../models/yuthon_vacation_reports.py | 114 ++++++++++++------ 1 file changed, 79 insertions(+), 35 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index d7eec3b17..b6ab5f215 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -31,7 +31,7 @@ class YuthonVacationReports(models.Model): year_holiday = fields.Float(string="本年公休日", digits=(16, 3)) year_workday = fields.Float(string="本年工作日", digits=(16, 3)) year_sum = fields.Float(string="本年应休合计", digits=(16, 3), compute="_compute_year_sum") - used_this_year1 = fields.Float(string="本年已休", digits=(16, 3), compute="_compute_year_sum") + used_this_year1 = fields.Float(string="本年已休", digits=(16, 3)) remainder_year1 = fields.Float(string="本年剩余(补休)", digits=(16, 3), compute="_compute_year_sum") company_id = fields.Many2one(related="employee_id.company_id", string="公司", store=True) @@ -875,6 +875,37 @@ class VacationLeaveLine(models.Model): vacation_main = self.env['yuthon.vacation.reports'].browse(vals['vacation_id']) if vacation_main.vacation_state == 'confirmed': vals['is_confirm'] = True + + if vals.get('update_type') == 'reduce' and vals.get('vacation_id'): + vacation_main = self.env['yuthon.vacation.reports'].browse(vals['vacation_id']) + deduct_amount = vals.get('update_lines', 0.0) + + if not vacation_main or deduct_amount <= 0: + return super(VacationLeaveLine, self).create(vals) + + if vacation_main: + used_this_year_new = vacation_main.used_this_year + deduct_amount + vacation_main.write({'used_this_year': used_this_year_new}) + + #处理跨年场景:查找下月1号的假期记录并扣减previous_year + if vacation_main.vacation_date: + current_vacation_date = vacation_main.vacation_date + next_month_first_day = current_vacation_date + relativedelta(months=+1, day=1) + + # 判断是否跨年 + is_cross_year = current_vacation_date.year != next_month_first_day.year + if is_cross_year: + next_month_vacation = self.env['yuthon.vacation.reports'].search([ + ('employee_id', '=', vacation_main.employee_id.id), + ('vacation_date', '=', next_month_first_day), + ('vacation_state', 'in', ['not_sent', 'pending']), + ], limit=1) + + if next_month_vacation: + previous_year_new = next_month_vacation.previous_year- deduct_amount + previous_year_new = max(previous_year_new, 0.0) + next_month_vacation.write({'previous_year': previous_year_new}) + return super(VacationLeaveLine, self).create(vals) def _sync_to_employee(self, reverse=False): @@ -930,32 +961,6 @@ class VacationOverline(models.Model): 'view_mode': 'form', } - # def _sync_to_employee(self, reverse=False): - # """将数据同步到关联员工 - # :param reverse: 是否反向操作(用于删除场景) - # """ - # employee = self.vacation_id.employee_id - # employee.meal_number -= self.meal_number - # # 根据操作类型确定计算方式 - # sign = -1 if reverse else 1 - # if self.update_type == 'add': - # employee.write({ - # 'normal_overtime_hours': employee.normal_overtime_hours + (self.workday * sign), - # 'holiday_overtime_hours': employee.holiday_overtime_hours + (self.legal_day * sign), - # 'weekend_overtime_hours': employee.weekend_overtime_hours + (self.public_holidays * sign) - # }) - # elif self.update_type == 'reduce': - # employee.write({ - # 'normal_overtime_hours': employee.normal_overtime_hours - (self.workday * sign), - # 'holiday_overtime_hours': employee.holiday_overtime_hours - (self.legal_day * sign), - # 'weekend_overtime_hours': employee.weekend_overtime_hours - (self.public_holidays * sign) - # }) - # - # @api.model - # def create(self, vals): - # record = super(VacationOverline, self).create(vals) - # record._sync_to_employee() - # return record @api.model def create(self, vals): if vals.get('vacation_id'): @@ -967,30 +972,69 @@ class VacationOverline(models.Model): vacation_main = self.env['yuthon.vacation.reports'].browse(vals['vacation_id']) deduct_workday = vals.get('workday', 0.0) deduct_public = vals.get('public_holidays', 0.0) + deduct_legal = vals.get('legal_day', 0.0) + deduct_workday_convert = deduct_workday / 8 + deduct_public_convert = deduct_public / 8 + deduct_legal_convert = deduct_legal / 8 + deduct_total = deduct_workday_convert + deduct_public_convert + deduct_legal_convert if vacation_main: - vacation_deduct_vals = { - 'year_workday': vacation_main.year_workday - deduct_workday/8, - 'year_holiday': vacation_main.year_holiday - deduct_public/8, + vacation_used_vals = { + 'used_this_year1': (vacation_main.used_this_year1 or 0.0) + deduct_total } - vacation_main.write(vacation_deduct_vals) + vacation_main.write(vacation_used_vals) + is_cross_year = False + # 计算下月1号并判断是否跨年 if vacation_main.vacation_date: current_vacation_date = vacation_main.vacation_date next_month_first_day = current_vacation_date + relativedelta(months=+1, day=1) - # 必须是跨年才写入上年工作日 is_cross_year = current_vacation_date.year != next_month_first_day.year + + # 跨年场景 + if is_cross_year: + # 查找下月1号的未确认假期记录并扣减上年额度 next_month_vacation = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', vacation_main.employee_id.id), ('vacation_date', '=', next_month_first_day), ('vacation_state', 'in', ['not_sent', 'pending']), ], limit=1) - if is_cross_year: + if next_month_vacation: next_month_deduct_vals = { - 'last_workday': next_month_vacation.last_workday - deduct_workday/8, - 'last_holiday': next_month_vacation.last_holiday - deduct_public/8, + 'last_workday': next_month_vacation.last_workday - deduct_workday_convert, + 'last_holiday': next_month_vacation.last_holiday - deduct_public_convert, } next_month_vacation.write(next_month_deduct_vals) + if vals.get('update_type') == 'add' and vals.get('vacation_id'): + current_text = vals.get('text', '').strip() + if current_text != '上月额度继承': + vacation_main = self.env['yuthon.vacation.reports'].browse(vals['vacation_id']) + add_workday = vals.get('workday', 0.0) + add_public = vals.get('public_holidays', 0.0) + if vacation_main: + vacation_add_vals = { + 'year_workday': vacation_main.year_workday + add_workday / 8, + 'year_holiday': vacation_main.year_holiday + add_public / 8, + } + vacation_main.write(vacation_add_vals) + + if vacation_main.vacation_date: + current_vacation_date = vacation_main.vacation_date + next_month_first_day = current_vacation_date + relativedelta(months=+1, day=1) + # 必须是跨年才写入上年工作日 + is_cross_year = current_vacation_date.year != next_month_first_day.year + next_month_vacation = self.env['yuthon.vacation.reports'].search([ + ('employee_id', '=', vacation_main.employee_id.id), + ('vacation_date', '=', next_month_first_day), + ('vacation_state', 'in', ['not_sent', 'pending']), + ], limit=1) + if is_cross_year: + next_month_deduct_vals = { + 'last_workday': next_month_vacation.last_workday + add_workday / 8, + 'last_holiday': next_month_vacation.last_holiday + add_public / 8, + } + next_month_vacation.write(next_month_deduct_vals) + return super(VacationOverline, self).create(vals) # def unlink(self): From 2dc650f6dd61702bd66340f6292a6d147b36a3ce 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, 6 Jan 2026 11:59:25 +0800 Subject: [PATCH 05/24] =?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_purchase/models/inherit_purchase_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 90c59bc45..8de688802 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -17,7 +17,7 @@ class InheritPurchaseOrder(models.Model): ) name_title = fields.Char(string="默认标题", default='采购申请单', readonly=True) code = fields.Char(string="流水号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_workflow_approval_code')) - state = fields.Selection(selection_add=[('部门经理', '部门经理'), + state = fields.Selection(selection_add=[('部门经理', '部门经理'), ('工会主席', '工会主席'), ('协办', '协办'), ('分管领导', '分管领导'), ('总经理', '总经理')], default='draft') From 02879a7252c61907ef824e364c9a911c0b943691 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, 6 Jan 2026 11:59:35 +0800 Subject: [PATCH 06/24] =?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 | 1 - yuthon_hr_attendance/models/overtime_approval.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 14521e405..51db1a6ba 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -1092,7 +1092,6 @@ class SoongWorkflowMixin(models.AbstractModel): field_attrs.group_ids or field_attrs.user_ids ): invisible_arr.append(node.node_name) - read_num = '' if readonly_arr: id_el = etree.Element("field") id_el.set("name", "log_ids") diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index 7b19873cb..bf55a6161 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -333,6 +333,9 @@ class OvertimeApprovals(models.Model): existing_line.workday += workday existing_line.legal_day += legal_day existing_line.public_holidays += public_holidays + existing_line.year_holiday += public_holidays + existing_line.year_workday += workday + start_date = fields.Date.to_date(self.start_time) end_date = fields.Date.to_date(self.end_time) attendance_records = self.env['hr.attendance'].search([ From 89640fc4942910fd283bd2f1812302dcf133790c Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 13:35:18 +0800 Subject: [PATCH 07/24] 1 --- soong_workflow/wizard/soong_workflow_comment_wizard_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml index 17c941fbe..ba6155b55 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml +++ b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml @@ -28,6 +28,7 @@ style="font-weight: bold; margin-bottom: 8px; display: block;"/> + From 119c8589864baf3f6518f2868e6e5553c87fd2cd Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 13:53:43 +0800 Subject: [PATCH 08/24] 1 --- soong_workflow/models/soong_workflow_mixin.py | 16 ++++++++-------- .../soong_workflow_comment_wizard_view.xml | 13 +++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 8b470029b..69a9856b6 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -813,20 +813,20 @@ class SoongWorkflowMixin(models.AbstractModel): ('employee_id.user_role_ids', 'in', role_ids) ] # 如果有角色条件,添加到可见性条件中 - # if role_domain: - # allowed_user_ids = self.env['res.users'].search(role_domain).ids - # invisible += f" or uid not in {allowed_user_ids}" + if role_domain: + allowed_user_ids = self.env['res.users'].search(role_domain).ids + invisible += f" or uid not in {allowed_user_ids}" # 如果有隐藏条件的话,启用隐藏 if button.is_review_invisible and button.invisible_expression: domain = eval(button.invisible_expression) btn_invisible = self.sudo().env[button.workflow_id.model_id.model].search(domain).ids invisible += " or id not in {0} ".format(str(btn_invisible)) # 如果是加签确认 - if is_apostille: - id_el = etree.Element("field") - id_el.set("name", "approval_sign_ids") - id_el.set("invisible", "1") - invisible += " or uid not in approval_sign_ids" + # if is_apostille: + # id_el = etree.Element("field") + # id_el.set("name", "approval_sign_ids") + # id_el.set("invisible", "1") + # invisible += " or uid not in approval_sign_ids" if button.name in ["退回", "结束"]: id_el = etree.Element("field") id_el.set("name", "log_ids") diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml index ba6155b55..3ed46ff3f 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml +++ b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml @@ -23,13 +23,17 @@ +
+

当前流程是否结束,请确认

+
-
+ + +
@@ -71,9 +75,6 @@ -
-

当前流程是否结束,请确认

-

当前流程是否收回,请确认

From 1965435abe451cdcbc680d5f9403846ab703ebcf Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 14:26:18 +0800 Subject: [PATCH 09/24] 1 --- soong_workflow/models/soong_workflow_mixin.py | 4 ++-- soong_workflow/wizard/soong_workflow_comment_wizard.py | 1 + yuthon_official/models/yuthon_official_incoming_normal.py | 1 + .../views/yuthon_official_incoming_normal_views.xml | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 69a9856b6..91bb211a3 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -833,13 +833,13 @@ class SoongWorkflowMixin(models.AbstractModel): id_el.set("invisible", "1") invisible += " or not log_ids " + if button.name == "分发": + invisible += " or not is_send" if button.name == "收回": id_el = etree.Element("field") id_el.set("name", "log_ids") id_el.set("invisible", "1") invisible += " or not log_ids or not is_back" - # if button.name == "结束": - # invisible += " or True" invisible += " or work_end" if model == 'purchase.order': diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index a2faccf4c..64705a51c 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -661,6 +661,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): description=f"编号为{record_id.code}的{record_id._description}已结束,请归档", url=url, btntxt="查看详情") if self.node_btn_name == "分发": + self.is_send = True workflow_record_id = self.env['soong.workflow.record'].search([('code', '=', record_id.code)]) action_id = self.env['ir.actions.act_window'].search([('res_model', '=', self.res_model)])[0] url = f'https://oa.thtzjt.com/web#id={record_id.id}&cids=2&action={action_id.id}&model={self.res_model}&view_type=from&menu_id={record_id.id}' diff --git a/yuthon_official/models/yuthon_official_incoming_normal.py b/yuthon_official/models/yuthon_official_incoming_normal.py index 9850cd85e..c1eb71846 100644 --- a/yuthon_official/models/yuthon_official_incoming_normal.py +++ b/yuthon_official/models/yuthon_official_incoming_normal.py @@ -31,6 +31,7 @@ class YuthonOfficialIncomingNormal(models.Model): active = fields.Boolean('Active', default=True, tracking=True) work_end = fields.Boolean(string="结束") + is_send = fields.Boolean(string="是否分发") is_issues = fields.Boolean(string="是否上会") issues_result = fields.Html(string="会议结果") is_supervising = fields.Boolean(string="是否督办") diff --git a/yuthon_official/views/yuthon_official_incoming_normal_views.xml b/yuthon_official/views/yuthon_official_incoming_normal_views.xml index 7566c1b06..98eee1d59 100644 --- a/yuthon_official/views/yuthon_official_incoming_normal_views.xml +++ b/yuthon_official/views/yuthon_official_incoming_normal_views.xml @@ -43,6 +43,7 @@
+ From 180460eb17db3bd590bf7c5958114c439168cfd7 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, 6 Jan 2026 15:03:13 +0800 Subject: [PATCH 10/24] =?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 --- .../models/yuthon_vacation_reports.py | 5 +---- yuthon_issue/models/issue_library.py | 2 +- yuthon_issue/views/issue_library_views.xml | 6 +++--- yuthon_official/models/yuthon_official.py | 15 +++++++++++++++ yuthon_official/models/yuthon_sub_enterprises.py | 1 + yuthon_official/views/yuthon_official_views.xml | 1 + .../views/yuthon_sub_enterprises_view.xml | 1 + 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index b6ab5f215..8f489316f 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -878,10 +878,7 @@ class VacationLeaveLine(models.Model): if vals.get('update_type') == 'reduce' and vals.get('vacation_id'): vacation_main = self.env['yuthon.vacation.reports'].browse(vals['vacation_id']) - deduct_amount = vals.get('update_lines', 0.0) - - if not vacation_main or deduct_amount <= 0: - return super(VacationLeaveLine, self).create(vals) + deduct_amount = vals.get('update_lines', 0.0) / 8 if vacation_main: used_this_year_new = vacation_main.used_this_year + deduct_amount diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py index f7f8e8a1f..1707e215c 100644 --- a/yuthon_issue/models/issue_library.py +++ b/yuthon_issue/models/issue_library.py @@ -244,7 +244,7 @@ class IssueLibrary(models.Model): self.issue_approval_id = issue_approval_id return { "type": "ir.actions.act_window", - "name": "批量提交", + "name": "提交议题审批", "res_model": "issue.approval", "views": [[form_id, "form"]], "res_id": issue_approval_id.id, diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index 05ed4664b..e01ffc0b8 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -45,9 +45,9 @@ decoration-info="issue_state == 'will'" decoration-success="issue_state == 'done'" decoration-muted="issue_state == 'cancel'"> - - - +
+
diff --git a/yuthon_official/models/yuthon_official.py b/yuthon_official/models/yuthon_official.py index a3ce672a7..1d1f6632c 100644 --- a/yuthon_official/models/yuthon_official.py +++ b/yuthon_official/models/yuthon_official.py @@ -57,6 +57,7 @@ class YuthonOfficial(models.Model): issue_library_ids = fields.One2many('issue.library', 'yuthon_official_id', string="议题关联") work_end = fields.Boolean(string="结束") official_state = fields.Selection([('to_do', '待转'), ('done', '已转')], string="状态") + sub_id = fields.Many2one('yuthon.sub.enterprises', string="文件处理流程") def _get_default_name_title(self): return self._description if self._description else self._name @@ -64,6 +65,20 @@ class YuthonOfficial(models.Model): name_title = fields.Char(default=_get_default_name_title) self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) + + def end_approval(self): + self.write({'work_end': True}) + if self.main_flats_id.name == '广州市天河投资集团有限公司': + process_id = self.env['yuthon.sub.enterprises'].search([('issuance_process_id', '=', self.id)]) + if not process_id: + official_partner_id = self.env['official.partner'].search([('name', '=', '广州市天河投资集团有限公司')]) + sub_id = self.env['yuthon.sub.enterprises'].create({ + 'users_id': self.users_id.id, + 'official_partner_id': official_partner_id.id, + 'issuance_process_id': self.id, + }) + self.write({'sub_id': sub_id.id}) + @api.onchange('is_cold') def onchange_is_cold(self): if self.is_cold: diff --git a/yuthon_official/models/yuthon_sub_enterprises.py b/yuthon_official/models/yuthon_sub_enterprises.py index d0d7aa369..ed365ee8f 100644 --- a/yuthon_official/models/yuthon_sub_enterprises.py +++ b/yuthon_official/models/yuthon_sub_enterprises.py @@ -15,6 +15,7 @@ class YuthonSubEnterprises(models.Model): users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司") department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门") + issuance_process_id = fields.Many2one('yuthon.official', string="发文流程") come_file_id = fields.Char(string="来文编号") reason_application = fields.Text(string="事由") official_partner_id = fields.Many2one('official.partner', string="来文单位") diff --git a/yuthon_official/views/yuthon_official_views.xml b/yuthon_official/views/yuthon_official_views.xml index 021248b0f..6aa902ba9 100644 --- a/yuthon_official/views/yuthon_official_views.xml +++ b/yuthon_official/views/yuthon_official_views.xml @@ -81,6 +81,7 @@ + diff --git a/yuthon_official/views/yuthon_sub_enterprises_view.xml b/yuthon_official/views/yuthon_sub_enterprises_view.xml index 59a4059b3..012b1ebd4 100644 --- a/yuthon_official/views/yuthon_sub_enterprises_view.xml +++ b/yuthon_official/views/yuthon_sub_enterprises_view.xml @@ -45,6 +45,7 @@ + From 38fcc43e5fb81c3bb340f53ed2a6b0e1e53f04da 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, 6 Jan 2026 15:04:27 +0800 Subject: [PATCH 11/24] =?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_official/models/yuthon_official.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yuthon_official/models/yuthon_official.py b/yuthon_official/models/yuthon_official.py index 1d1f6632c..bd984debb 100644 --- a/yuthon_official/models/yuthon_official.py +++ b/yuthon_official/models/yuthon_official.py @@ -73,6 +73,7 @@ class YuthonOfficial(models.Model): if not process_id: official_partner_id = self.env['official.partner'].search([('name', '=', '广州市天河投资集团有限公司')]) sub_id = self.env['yuthon.sub.enterprises'].create({ + 'name': '广州市天河投资集团有限公司文件处理', 'users_id': self.users_id.id, 'official_partner_id': official_partner_id.id, 'issuance_process_id': self.id, From 637e8f616a9dd0823a168431521b38634e542c4b Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 15:05:42 +0800 Subject: [PATCH 12/24] 1 --- .../wizard/soong_workflow_comment_wizard.py | 59 +++++++++---------- .../yuthon_official_incoming_normal_views.xml | 2 +- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 64705a51c..63ab59bc4 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -577,7 +577,6 @@ class SoongWorkflowCommentWizard(models.TransientModel): log_records = record_id.log_ids2 elif record_id.log_ids: log_records = record_id.log_ids - if log_records: # 查找当前用户的日志记录并更新 user_log = log_records.filtered(lambda log: log.done_by == current_user) @@ -588,37 +587,33 @@ class SoongWorkflowCommentWizard(models.TransientModel): 'lase_click_date': current_datetime, 'document_ids': [(6, 0, self.document_ids.ids)] }) - last_log = log_records[-1] if log_records else None - if last_log: - same_name_logs = log_records.filtered( - lambda log: log.name == last_log.name - and log.node_btn_name == '4' - and log.id != last_log.id - ) - - # 判断是否需要更新工作流状态 - if same_name_logs: - all_approved = all(log.approval_state == '3' for log in same_name_logs) - all_approved = all_approved and (last_log.approval_state == '3') - if all_approved: - # 所有符合条件的记录都已批准,更新工作流状态 - self.env['soong.workflow.record'].search([ - ('code', '=', record_id.code) - ]).write({ - 'approve_state': 'end', - 'employee_ids': False, - 'node_id': False, - }) - record_id.work_end = True - else: - self.env['soong.workflow.record'].search([ - ('code', '=', record_id.code) - ]).write({ - 'approve_state': 'end', - 'employee_ids': False, - 'node_id': False, - }) - record_id.work_end = True + if not self.log_ids.search([('approval_state', 'in', ['0', '1'])]): + record_id.work_end = True + # last_log = log_records[-1] if log_records else None + # if last_log: + # same_name_logs = log_records.filtered(lambda log: log.name == last_log.name and log.node_btn_name == '4' and log.id != last_log.id) + # + # # 判断是否需要更新工作流状态 + # if same_name_logs: + # all_approved = all(log.approval_state == '3' for log in same_name_logs) + # all_approved = all_approved and (last_log.approval_state == '3') + # if all_approved: + # # 所有符合条件的记录都已批准,更新工作流状态 + # self.env['soong.workflow.record'].search([('code', '=', record_id.code)]).write({ + # 'approve_state': 'end', + # 'employee_ids': False, + # 'node_id': False, + # }) + # record_id.work_end = True + # else: + # self.env['soong.workflow.record'].search([ + # ('code', '=', record_id.code) + # ]).write({ + # 'approve_state': 'end', + # 'employee_ids': False, + # 'node_id': False, + # }) + # record_id.work_end = True # 给申请人发消息 biz_record = self.env[self.res_model].browse(self.res_id) diff --git a/yuthon_official/views/yuthon_official_incoming_normal_views.xml b/yuthon_official/views/yuthon_official_incoming_normal_views.xml index 98eee1d59..3479da46b 100644 --- a/yuthon_official/views/yuthon_official_incoming_normal_views.xml +++ b/yuthon_official/views/yuthon_official_incoming_normal_views.xml @@ -43,7 +43,7 @@ - + From 7e94c68faa46bb7a1c1c9dc60eb49b5acc650eb3 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, 6 Jan 2026 15:10:12 +0800 Subject: [PATCH 13/24] =?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_official/models/yuthon_sub_enterprises.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuthon_official/models/yuthon_sub_enterprises.py b/yuthon_official/models/yuthon_sub_enterprises.py index ed365ee8f..98c52dbbd 100644 --- a/yuthon_official/models/yuthon_sub_enterprises.py +++ b/yuthon_official/models/yuthon_sub_enterprises.py @@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError, UserError class YuthonSubEnterprises(models.Model): _name = 'yuthon.sub.enterprises' _description = '文件处理(子企业)' - _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin'] + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] _rec_name = 'name' From 3d384ef0b7a368540ec409070e662cb00b186596 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, 6 Jan 2026 15:53:34 +0800 Subject: [PATCH 14/24] =?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/wizard/soong_bounced_wizard.py | 8 ++++++-- yuthon_issue/models/inherit_room_booking.py | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/soong_workflow/wizard/soong_bounced_wizard.py b/soong_workflow/wizard/soong_bounced_wizard.py index 7c1bec996..79972b2c2 100644 --- a/soong_workflow/wizard/soong_bounced_wizard.py +++ b/soong_workflow/wizard/soong_bounced_wizard.py @@ -24,19 +24,23 @@ class SoongBouncedWizard(models.Model): if invalid_logs: raise UserError('当前状态不可以收回') - prev_log = None total_log_count = len(log_ids) deleted_log_count = len(log_to_delete) prev_log_index = (total_log_count - deleted_log_count) - 1 + other_log_index = total_log_count - deleted_log_count if prev_log_index < 0 or prev_log_index >= len(log_ids): raise UserError('无有效的上一级审批明细行,无法执行收回操作') prev_log = log_ids[prev_log_index] related_record = self.env[self.res_model].browse(self.res_id) + done_by_list = [] + for index in range(other_log_index): + done_by_list.append(log_ids[index].done_by.id) + if hasattr(related_record, 'self_users_ids'): related_record.self_users_ids = [(6, 0, [prev_log.done_by.id])] self.env['soong.workflow.record'].search([('code', '=', record.code)]).write({"employee_ids": [(6, 0, [prev_log.done_by.employee_ids.id])], - "users_ids": [(6, 0, [prev_log.done_by.id])], + "users_ids": [(6, 0, done_by_list)], 'soong_state': 'to_do' }) log_to_delete.unlink() diff --git a/yuthon_issue/models/inherit_room_booking.py b/yuthon_issue/models/inherit_room_booking.py index e8ff7dbb1..b21df9660 100644 --- a/yuthon_issue/models/inherit_room_booking.py +++ b/yuthon_issue/models/inherit_room_booking.py @@ -58,8 +58,14 @@ class RoomBooking(models.Model): return res for idx, (main_record, vals) in enumerate(zip(res, vals_list)): issue_meeting_lines = vals.get('issue_meeting_line_ids', []) + if not isinstance(issue_meeting_lines, list): + continue for line_triple in issue_meeting_lines: + if not (isinstance(line_triple, (list, tuple)) and len(line_triple) == 3): + continue line_state, line_id, line_vals = line_triple + if line_state != 0 or not isinstance(line_vals, dict): + continue issue_library_id = line_vals.get('issue_library_id') room_id = vals.get('room_id') meeting_type_id = vals.get('meeting_type_id') From ddb88e604e9ac1083c5a54716413fe9943535cc6 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 15:56:32 +0800 Subject: [PATCH 15/24] 1 --- soong_workflow/models/soong_workflow_log.py | 1 + soong_workflow/models/soong_workflow_mixin.py | 8 ++------ soong_workflow/templates/soong_workflow_templates.xml | 6 ++++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/soong_workflow/models/soong_workflow_log.py b/soong_workflow/models/soong_workflow_log.py index f0bd582aa..b77537595 100644 --- a/soong_workflow/models/soong_workflow_log.py +++ b/soong_workflow/models/soong_workflow_log.py @@ -85,6 +85,7 @@ class SoongWorkflowLog2(models.Model): approval_state = fields.Selection([('0', '未读'), ('1', '已读')], string='状态', default='0') document_ids = fields.Many2many('ir.attachment', string="附件") lase_click_date = fields.Datetime(string="操作时间") + commit = fields.Char(string="意见") @api.depends("workflow_id", "node_id", "node_btn_id") diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 91bb211a3..912998801 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -22,9 +22,7 @@ class SoongWorkflowMixin(models.AbstractModel): for rec in self: if rec.log_ids: current_user = self.env.user - target_logs = rec.log_ids.filtered( - lambda l: l.done_by.id == current_user.id and l.approval_state == '0' - ) + target_logs = rec.log_ids.filtered(lambda l: l.done_by.id == current_user.id and l.approval_state == '0') if target_logs: target_logs.write({'approval_state': '1'}) return super(SoongWorkflowMixin, self).read(fields=fields, load=load) @@ -1090,9 +1088,7 @@ class SoongWorkflowMixin(models.AbstractModel): has_group = user_rec.has_group(ext_id) if not has_group: flag_show = False - if not flag_show and ( - field_attrs.group_ids or field_attrs.user_ids - ): + if not flag_show and (field_attrs.group_ids or field_attrs.user_ids): invisible_arr.append(node.node_name) if readonly_arr: id_el = etree.Element("field") diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml index c96b87cac..d8a3c8500 100644 --- a/soong_workflow/templates/soong_workflow_templates.xml +++ b/soong_workflow/templates/soong_workflow_templates.xml @@ -36,7 +36,8 @@ - + + @@ -99,7 +100,8 @@ - + + From 3163c534465ea18b1bf6a9a9b41699e80f3d67f4 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 16:38:34 +0800 Subject: [PATCH 16/24] 1 --- .../wizard/soong_workflow_comment_wizard.py | 54 +++++++++++++------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 63ab59bc4..c07688be4 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -560,26 +560,18 @@ class SoongWorkflowCommentWizard(models.TransientModel): current_datetime = fields.Datetime.now() is_admin = current_user.has_group('soong_workflow.group_soong_workflow_manager') if is_admin: - write_vals = { + record_id.log_ids[-1].sudo().write({ 'comment': self.comment, 'approval_state': "3", 'lase_click_date': fields.Datetime.now() - timedelta(hours=8), - 'document_ids': [(6, 0, self.document_ids.ids)] # Many2many 替换语法 - } - record_id.log_ids[-1].sudo().write(write_vals) - record_id.work_end = True + 'document_ids': [(6, 0, self.document_ids.ids)] + }) self.env['soong.workflow.record'].search([('code', '=', record_id.code)]).write({'approve_state': 'end', "employee_ids": False, "node_id": False, }) else: - log_records = record_id.log_ids - if record_id.log_ids2: - log_records = record_id.log_ids2 - elif record_id.log_ids: - log_records = record_id.log_ids - if log_records: - # 查找当前用户的日志记录并更新 - user_log = log_records.filtered(lambda log: log.done_by == current_user) + if record_id.log_ids: + user_log = record_id.log_ids.filtered(lambda log: log.done_by == current_user) if user_log: user_log.write({ 'comment': self.comment, @@ -587,8 +579,8 @@ class SoongWorkflowCommentWizard(models.TransientModel): 'lase_click_date': current_datetime, 'document_ids': [(6, 0, self.document_ids.ids)] }) - if not self.log_ids.search([('approval_state', 'in', ['0', '1'])]): - record_id.work_end = True + if not record_id.log_ids.search([('approval_state', 'in', ['0', '1'])]) and not record_id.log_ids2.search([('approval_state', '=', '0')]): + record_id.work_end = True # last_log = log_records[-1] if log_records else None # if last_log: # same_name_logs = log_records.filtered(lambda log: log.name == last_log.name and log.node_btn_name == '4' and log.id != last_log.id) @@ -655,6 +647,37 @@ class SoongWorkflowCommentWizard(models.TransientModel): title=record_id._description, description=f"编号为{record_id.code}的{record_id._description}已结束,请归档", url=url, btntxt="查看详情") + if self.node_btn_name == '确认': + log_rec_id = record_id.log_ids2.filtered(lambda log: log.done_by == self.env.user) + log_rec_id.write({ + 'comment': self.comment, + 'approval_state': "1", + 'lase_click_date': fields.datetime.now(), + 'document_ids': [(6, 0, self.document_ids.ids)] + }) + for employee in self.circulated_employee_ids: + workflow_record_id = self.env['soong.workflow.record'].search([('code', '=', record_id.code)]) + workflow_record_id.users_ids = [(4, employee.user_id.id) for employee in self.circulated_employee_ids if employee.user_id] + workflow_record_id.employee_ids = [(4, self.circulated_employee_ids.ids)] + record_id = self.env[self.res_model].search([('id', '=', self.res_id)]) + self.sudo().env["soong.workflow.record.copy"].create({ + "code": record_id.code, + "name": record_id.name, + "res_model": self.res_model, + "workflow_id": self.node_btn_id.workflow_id.id, + "res_id": self.res_id, + "done_by": employee.user_id.id, + "approval_state_copy": "0", + }) + self.sudo().env["soong.workflow.log2"].create({ + "model": self.res_model, + "res_id": self.res_id, + "node_id": self.node_btn_id.node_id.id, + "workflow_id": self.node_btn_id.workflow_id.id, + "done_by": employee.user_id.id, + "node_btn_id": self.node_btn_id.id, + "approval_state": "0", + }) if self.node_btn_name == "分发": self.is_send = True workflow_record_id = self.env['soong.workflow.record'].search([('code', '=', record_id.code)]) @@ -734,7 +757,6 @@ class SoongWorkflowCommentWizard(models.TransientModel): record.write({'state': log_ids[-2].name, 'work_end': False}) return self.node_btn_id.with_context(cx).run() - def update_self_users_ids(self): related_record = self.env[self.res_model].browse(self.res_id) if hasattr(related_record, 'self_users_ids'): From 7b00867e01345703bc8c7922b32ee395a7a3a52f Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Tue, 6 Jan 2026 16:58:04 +0800 Subject: [PATCH 17/24] 1 --- .../wizard/soong_workflow_comment_wizard.py | 9 +++++---- yuthon_work_brand/views/hr_menus.xml | 20 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index c07688be4..570507d21 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -562,7 +562,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): if is_admin: record_id.log_ids[-1].sudo().write({ 'comment': self.comment, - 'approval_state': "3", + 'approval_state': "2", 'lase_click_date': fields.Datetime.now() - timedelta(hours=8), 'document_ids': [(6, 0, self.document_ids.ids)] }) @@ -575,7 +575,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): if user_log: user_log.write({ 'comment': self.comment, - 'approval_state': "3", + 'approval_state': "2", 'lase_click_date': current_datetime, 'document_ids': [(6, 0, self.document_ids.ids)] }) @@ -700,7 +700,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=self.employee_ids.wecom_userid, title=record_id._description, description=description, url=url, btntxt="查看详情") for emp in self.dep_manager_employee_ids: workflow_record_id.users_ids = [(4, employee.user_id.id) for employee in self.dep_manager_employee_ids if employee.user_id] - next_node_id = record_id.workflow_id.node_ids.search([('name', '=', '承办'),('workflow_id', '=', record_id.workflow_id.id)]) + next_node_id = record_id.workflow_id.node_ids.search([('name', '=', '承办'), ('workflow_id', '=', record_id.workflow_id.id)]) record_id.log_ids[-1].write({"comment": self.comment, "approval_state": "2", "lase_click_date": fields.Datetime.now()}) self.sudo().env["soong.workflow.log"].create({ "code": self.code, @@ -712,8 +712,8 @@ class SoongWorkflowCommentWizard(models.TransientModel): "node_btn_name": "0", }) self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=emp.wecom_userid, title=record_id._description + "承办", description=description, url=url, btntxt="查看详情") - workflow_record_id.employee_ids = self.dep_manager_employee_ids + self.employee_ids for employee in self.circulated_employee_ids: + workflow_record_id.users_ids = [(4, employee.user_id.id) for employee in self.circulated_employee_ids if employee.user_id] record_id = self.env[self.res_model].search([('id', '=', self.res_id)]) self.sudo().env["soong.workflow.record.copy"].create({ "code": record_id.code, @@ -734,6 +734,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): "approval_state": "0", }) self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=employee.wecom_userid, title=record_id._description + "传阅/抄送",description=description, url=url, btntxt="查看详情") + workflow_record_id.employee_ids = self.dep_manager_employee_ids + self.employee_ids + self.circulated_employee_ids if self.node_btn_name == "收回": # recall_url = f'https://qyapi.weixin.qq.com/cgi-bin/message/recall?access_token={access_token}' record = self.env[self.res_model].search([('id', '=', self.res_id)]) diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 0fc726a1c..77a40aa07 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -719,16 +719,16 @@ parent="holiday_manage_menu_root_board" action="soong_workflow.soong_workflow_department_record_action" sequence="4"/> - - + + + + + + + + + + Date: Tue, 6 Jan 2026 17:19:06 +0800 Subject: [PATCH 18/24] =?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_record.py | 9 +++++++++ soong_workflow/views/soong_workflow_record.xml | 3 ++- soong_workflow/wizard/soong_workflow_comment_wizard.py | 7 ++++--- yuthon_issue/models/inherit_room_booking.py | 3 +++ yuthon_official/models/yuthon_official.py | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index 6dc568880..348b16a40 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -57,6 +57,7 @@ class SoongWorkflowRecord(models.Model): # 人力资源流程的发生日期 workflow_happen_date = fields.Date(string="发生日期") + is_unlink = fields.Boolean(string="是否可删", compute='_compute_is_unlink') @api.depends_context('uid', 'company') @api.depends('department_id', 'employee_ids') @@ -77,6 +78,14 @@ class SoongWorkflowRecord(models.Model): has_valid_employee = bool(record.employee_ids & valid_employee_ids) record.member_of_department = has_valid_employee + @api.depends('create_uid', 'employee_ids') + def _compute_is_unlink(self): + for record in self: + if len(record.employee_ids) == 1 and record.employee_ids.user_id.id == record.create_uid.id: + record.is_unlink = True + else: + record.is_unlink = False + def _get_valid_employee_for_user(self): user = self.env.user employee = user.employee_ids diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index b3af83edf..6d520c8fd 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -133,8 +133,9 @@ +