From b151d4402fc6b5f2bd8ae574eaad082391ecc8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 8 Jan 2026 11:12:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/__manifest__.py | 5 +- yuthon_holiday/report/__init__.py | 0 .../report/hr_leave_batch_report_action.xml | 17 ++ .../report/hr_leave_batch_report_template.xml | 153 ++++++++++++++++++ yuthon_holiday/views/hr_leave_batch.xml | 7 + yuthon_issue/models/issue_library.py | 2 +- yuthon_issue/views/issue_library_views.xml | 4 +- .../report/purchase_order_print_templates.xml | 45 +++--- .../report/seal_approval_templates.xml | 2 +- yuthon_work_brand/views/hr_menus.xml | 20 +-- 10 files changed, 221 insertions(+), 34 deletions(-) create mode 100644 yuthon_holiday/report/__init__.py create mode 100644 yuthon_holiday/report/hr_leave_batch_report_action.xml create mode 100644 yuthon_holiday/report/hr_leave_batch_report_template.xml diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py index 082ef6c80..f1968c02a 100644 --- a/yuthon_holiday/__manifest__.py +++ b/yuthon_holiday/__manifest__.py @@ -9,17 +9,20 @@ 'security/ir.model.access.csv', 'security/yuthon_holiday_group.xml', 'data/yuthon_holiday_data.xml', + # 报表文件需先加载,供后续视图/按钮引用 + 'report/hr_leave_batch_report_template.xml', + 'report/hr_leave_batch_report_action.xml', 'views/inherit_hr_type_views.xml', 'views/inherit_hr_leave_allocation_views.xml', 'views/inherit_hr_leave_accrual_plan_views.xml', 'views/hr_leave_accrual_views.xml', 'views/yuthon_fixes_approval_views.xml', - 'views/hr_leave_batch.xml', 'views/yuthon_breastfeed_leave_views.xml', 'views/yuthon_holiday_setting_views.xml', 'wizard/yuthon_fixes_wizard_views.xml', 'wizard/leave_allocation_wizard_views.xml', 'wizard/yuthon_leave_wizard_views.xml', + 'views/hr_leave_batch.xml', ], 'assets': { 'web.assets_backend': [ diff --git a/yuthon_holiday/report/__init__.py b/yuthon_holiday/report/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/yuthon_holiday/report/hr_leave_batch_report_action.xml b/yuthon_holiday/report/hr_leave_batch_report_action.xml new file mode 100644 index 000000000..cf4c63371 --- /dev/null +++ b/yuthon_holiday/report/hr_leave_batch_report_action.xml @@ -0,0 +1,17 @@ + + + + + 请假单 + hr.leave.batch + qweb-pdf + + yuthon_holiday.hr_leave_batch_print + yuthon_holiday.hr_leave_batch_print + + + report + '请假单 - %s' % (object.name or '') + + + \ No newline at end of file diff --git a/yuthon_holiday/report/hr_leave_batch_report_template.xml b/yuthon_holiday/report/hr_leave_batch_report_template.xml new file mode 100644 index 000000000..952f5939d --- /dev/null +++ b/yuthon_holiday/report/hr_leave_batch_report_template.xml @@ -0,0 +1,153 @@ + + + + + + + \ No newline at end of file diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index 19b0d5e4a..785f57890 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -18,6 +18,13 @@ hr.leave.batch
+
+
diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py index f7779c856..63ca47476 100644 --- a/yuthon_issue/models/issue_library.py +++ b/yuthon_issue/models/issue_library.py @@ -16,7 +16,7 @@ class IssueLibrary(models.Model): topic_content = fields.Text(string='事项背景') will_based = fields.Text(string='上会依据') deliberation_content = fields.Text(string='请示事项', default='建议同意') - handling_situation = fields.Text(string='办理情况') + handling_situation = fields.Text(string='办理情况(存在问题)') is_invisible_workflow = fields.Boolean(string="流程隐藏的判断") code = fields.Char(string='编号', required=True, copy=False, default=lambda self: self.env['ir.sequence'].next_by_code('issue_library_code')) diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index e01ffc0b8..6aff9437c 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -109,12 +109,12 @@ + + - - diff --git a/yuthon_purchase/report/purchase_order_print_templates.xml b/yuthon_purchase/report/purchase_order_print_templates.xml index 3951f2fba..0b14b4ad8 100644 --- a/yuthon_purchase/report/purchase_order_print_templates.xml +++ b/yuthon_purchase/report/purchase_order_print_templates.xml @@ -6,7 +6,8 @@
-
采购审批单
-
+ +
部门:
@@ -127,34 +137,31 @@ - + 审批详情 + - 节点名称 - 意见 - 审批人 - 操作时间 - 状态 - 附件 + 节点名称 + 意见 + 审批人 - 操作时间 + 状态 + 附件 + - - - + + + - - - 待办 - 办理中 - 已办结 - 结束 - - + +
diff --git a/yuthon_trade/report/seal_approval_templates.xml b/yuthon_trade/report/seal_approval_templates.xml index 65f5fe04b..a28a08fa4 100644 --- a/yuthon_trade/report/seal_approval_templates.xml +++ b/yuthon_trade/report/seal_approval_templates.xml @@ -106,7 +106,7 @@ - - + diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml index 594172ad3..9a81f19e7 100644 --- a/yuthon_work_brand/views/hr_menus.xml +++ b/yuthon_work_brand/views/hr_menus.xml @@ -787,16 +787,16 @@ parent="holiday_manage_menu_root_board" sequence="20" action="yuthon_salary.action_view_my_payslip"/> - - + + + + + + + + + + Date: Thu, 8 Jan 2026 12:22:42 +0800 Subject: [PATCH 2/3] 1 --- .../views/contract_review_approval_views.xml | 5 ++++- yuthon_issue/models/issue_library.py | 2 +- yuthon_issue/views/issue_library_views.xml | 8 +++++--- yuthon_trade/views/yuthon_business_approval_viwes.xml | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/yuthon_hr_employee_approval/views/contract_review_approval_views.xml b/yuthon_hr_employee_approval/views/contract_review_approval_views.xml index 9a745d3ea..30f2d8066 100644 --- a/yuthon_hr_employee_approval/views/contract_review_approval_views.xml +++ b/yuthon_hr_employee_approval/views/contract_review_approval_views.xml @@ -65,9 +65,12 @@ - + + + + diff --git a/yuthon_issue/models/issue_library.py b/yuthon_issue/models/issue_library.py index 63ca47476..f7779c856 100644 --- a/yuthon_issue/models/issue_library.py +++ b/yuthon_issue/models/issue_library.py @@ -16,7 +16,7 @@ class IssueLibrary(models.Model): topic_content = fields.Text(string='事项背景') will_based = fields.Text(string='上会依据') deliberation_content = fields.Text(string='请示事项', default='建议同意') - handling_situation = fields.Text(string='办理情况(存在问题)') + handling_situation = fields.Text(string='办理情况') is_invisible_workflow = fields.Boolean(string="流程隐藏的判断") code = fields.Char(string='编号', required=True, copy=False, default=lambda self: self.env['ir.sequence'].next_by_code('issue_library_code')) diff --git a/yuthon_issue/views/issue_library_views.xml b/yuthon_issue/views/issue_library_views.xml index 6aff9437c..0028462f0 100644 --- a/yuthon_issue/views/issue_library_views.xml +++ b/yuthon_issue/views/issue_library_views.xml @@ -109,13 +109,13 @@ - + - + @@ -125,10 +125,12 @@ - + + + diff --git a/yuthon_trade/views/yuthon_business_approval_viwes.xml b/yuthon_trade/views/yuthon_business_approval_viwes.xml index 943650ec1..6518c95b1 100644 --- a/yuthon_trade/views/yuthon_business_approval_viwes.xml +++ b/yuthon_trade/views/yuthon_business_approval_viwes.xml @@ -56,11 +56,14 @@ - + + + + From 2d93c3b5c5085a63e5ae0c023d1a7cfdc2616ff1 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: Thu, 8 Jan 2026 12:26:48 +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 --- yuthon_holiday/models/inherit_hr_leave.py | 130 ++++++++++++--------- yuthon_hr_attendance/models/go_approval.py | 29 +++-- 2 files changed, 97 insertions(+), 62 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index e22796eea..3acfd79bc 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -485,78 +485,104 @@ class HolidaysRequestBatch(models.Model): return date_ranges def _create_overtime_leave_line(self, period_start, leave_data, hours, period, leave_type_name): - """为补休类型创建加班明细行(vacation.over.line),类型为减少,值赋给workday""" + """为补休类型创建加班明细行(vacation.over.line),类型为减少,值赋给workday(增加重复校验)""" + # 1. 计算报表月份的起始和结束日期,简化代码结构 report_month = date(period_start.year, period_start.month, 1) + month_end = date(period_start.year, period_start.month, + calendar.monthrange(period_start.year, period_start.month)[1]) + + # 2. 查询对应的假期报表记录 vacation_report = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', self.users_id.employee_ids.id), ('vacation_date', '>=', fields.Date.to_string(report_month)), - ('vacation_date', '<=', fields.Date.to_string( - date(period_start.year, period_start.month, - calendar.monthrange(period_start.year, period_start.month)[1])) - ) + ('vacation_date', '<=', fields.Date.to_string(month_end)) ], limit=1) - self.env['vacation.over.line'].create({ - 'vacation_id': vacation_report.id if vacation_report else False, - 'employee_id': self.users_id.employee_ids.id, - 'workflow_record_id': leave_data['workflow_id'], - 'update_type': 'reduce', - 'workday': hours, - 'legal_day': 0, - 'public_holidays': 0, - 'meal_number': 0, - 'update_date': fields.Date.today(), - 'is_void': False, - 'text': f"请假审批" - }) - + existing_overtime_line = self.env['vacation.over.line'].search([ + ('employee_id', '=', self.users_id.employee_ids.id), + ('workflow_record_id', '=', leave_data.get('workflow_id', False)), + ('update_type', '=', 'reduce'), + ('text', '=', '请假审批'), + ('is_void', '=', False), + ('workday', '=', hours), + ], limit=1) + if not existing_overtime_line: + self.env['vacation.over.line'].create({ + 'vacation_id': vacation_report.id if vacation_report else False, + 'employee_id': self.users_id.employee_ids.id, + 'workflow_record_id': leave_data['workflow_id'], + 'update_type': 'reduce', + 'workday': hours, + 'legal_day': 0, + 'public_holidays': 0, + 'meal_number': 0, + 'update_date': fields.Date.today(), + 'is_void': False, + 'text': f"请假审批" + }) def _create_annual_leave_line(self, period_start, leave_data, hours, period): - """更新年假记录,使用小时作为单位""" + """更新年假记录,使用小时作为单位(增加重复校验,避免重复创建)""" report_month = date(period_start.year, period_start.month, 1) + month_end = date(period_start.year, period_start.month, + calendar.monthrange(period_start.year, period_start.month)[1]) vacation_report = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', self.users_id.employee_ids.id), ('vacation_date', '>=', fields.Date.to_string(report_month)), - ('vacation_date', '<=', fields.Date.to_string( - date(period_start.year, period_start.month, - calendar.monthrange(period_start.year, period_start.month)[1])) - ) + ('vacation_date', '<=', fields.Date.to_string(month_end)) ], limit=1) - - self.env['vacation.leave.line'].create({ - 'vacation_id': vacation_report.id if vacation_report else False, - 'employee_id': self.users_id.employee_ids.id, - 'workflow_record_id': leave_data['workflow_id'], - 'update_type': 'reduce', - 'update_date': fields.Date.today(), - 'update_lines': hours, - 'is_void': False, - 'allocation_type': 'vacation', - 'text': f"请假审批" - }) + existing_annual_leave_line = self.env['vacation.leave.line'].search([ + ('employee_id', '=', self.users_id.employee_ids.id), + ('workflow_record_id', '=', leave_data.get('workflow_id', False)), + ('update_type', '=', 'reduce'), + ('allocation_type', '=', 'vacation'), + ('update_lines', '=', hours), + ('text', '=', '请假审批'), + ('is_void', '=', False), + ], limit=1) + if not existing_annual_leave_line: + self.env['vacation.leave.line'].create({ + 'vacation_id': vacation_report.id if vacation_report else False, + 'employee_id': self.users_id.employee_ids.id, + 'workflow_record_id': leave_data['workflow_id'], + 'update_type': 'reduce', + 'update_date': fields.Date.today(), + 'update_lines': hours, + 'is_void': False, + 'allocation_type': 'vacation', + 'text': f"请假审批" + }) def _create_other_leave_line(self, period_start, leave_data, days, period, leave_type_name): - """更新其他假期记录,使用小时作为单位""" holiday_type = self.env['hr.leave.type'].search([('name', '=', leave_type_name)], limit=1) report_month = date(period_start.year, period_start.month, 1) + month_end = date(period_start.year, period_start.month, + calendar.monthrange(period_start.year, period_start.month)[1]) vacation_report = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', self.users_id.employee_ids.id), ('vacation_date', '>=', fields.Date.to_string(report_month)), - ('vacation_date', '<=', fields.Date.to_string( - date(period_start.year, period_start.month, - calendar.monthrange(period_start.year, period_start.month)[1])) - ) + ('vacation_date', '<=', fields.Date.to_string(month_end)) ], limit=1) - self.env['vacation.other.line'].create({ - 'vacation_id': vacation_report.id if vacation_report else False, - 'employee_id': self.users_id.employee_ids.id, - 'workflow_record_id': leave_data['workflow_id'], - 'update_type': 'reduce', - 'lines': days, - 'holiday_type': holiday_type.id, - 'update_date': fields.Date.today(), - 'is_void': False, - 'text': f"请假审批" - }) + existing_leave_line = self.env['vacation.other.line'].search([ + ('employee_id', '=', self.users_id.employee_ids.id), + ('workflow_record_id', '=', leave_data.get('workflow_id', False)), + ('holiday_type', '=', holiday_type.id), + ('lines', '=', days), + ('update_type', '=', 'reduce'), + ('text', '=', '请假审批'), + ('is_void', '=', False), + ], limit=1) + if not existing_leave_line: + self.env['vacation.other.line'].create({ + 'vacation_id': vacation_report.id if vacation_report else False, + 'employee_id': self.users_id.employee_ids.id, + 'workflow_record_id': leave_data['workflow_id'], + 'update_type': 'reduce', + 'lines': days, + 'holiday_type': holiday_type.id, + 'update_date': fields.Date.today(), + 'is_void': False, + 'text': f"请假审批" + }) def update_attendance(self, employee_id, start_date, end_date, code): """ diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py index 5b840340f..12f258f00 100644 --- a/yuthon_hr_attendance/models/go_approval.py +++ b/yuthon_hr_attendance/models/go_approval.py @@ -177,24 +177,33 @@ class GoApprovals(models.Model): def end_approval(self): if self.meal == 'yes': - # 创建日志 first_day = self.start_date.replace(day=1) reports_id = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', self.users_id.employee_id.id), ('vacation_date', '=', first_day) ]) + if not reports_id: + return workflow_record_id = self.env['soong.workflow.record'].search([ ('code', '=', self.code) ]) - meal_fee_value = (0, 0, { - 'vacation_id': reports_id.id, - 'update_type': 'add', - 'workflow_record_id': workflow_record_id.id, - 'update_date': fields.Datetime.now(), - 'update_lines': 1, - 'text': '审批' - }) - reports_id.write({'meal_fee_ids': [meal_fee_value]}) + existing_meal_fee = self.env['yuthon.vacation.reports.meal.fee'].search([ + ('vacation_id', '=', reports_id.id), + ('workflow_record_id', '=', workflow_record_id.id if workflow_record_id else False), + ('update_type', '=', 'add'), + ('text', '=', '审批'), + ('update_lines', '=', 1) + ]) + if not existing_meal_fee: + meal_fee_value = (0, 0, { + 'vacation_id': reports_id.id, + 'update_type': 'add', + 'workflow_record_id': workflow_record_id.id if workflow_record_id else False, + 'update_date': fields.Datetime.now(), + 'update_lines': 1, + 'text': '审批' + }) + reports_id.write({'meal_fee_ids': [meal_fee_value]}) for employee in self.employee_ids: if self.is_day: