From 6b42a13b55517152024f697c00f2cf2a69bb50b2 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Tue, 3 Jun 2025 20:10:57 +0800
Subject: [PATCH] =?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
---
.../security/yuthon_holiday_group.xml | 5 +
.../models/hr_attendance_month.py | 3 +-
.../security/planning_group.xml | 106 +-----------------
.../views/hr_attendance_month_views.xml | 1 +
yuthon_salary/models/inherit_hr_payslip.py | 1 +
.../views/inherit_hr_payslip_views.xml | 5 +-
yuthon_salary/wizard/salary_compute_wizard.py | 28 ++++-
.../wizard/salary_compute_wizard_views.xml | 4 +-
8 files changed, 46 insertions(+), 107 deletions(-)
diff --git a/yuthon_holiday/security/yuthon_holiday_group.xml b/yuthon_holiday/security/yuthon_holiday_group.xml
index 76f799240..ad309f170 100644
--- a/yuthon_holiday/security/yuthon_holiday_group.xml
+++ b/yuthon_holiday/security/yuthon_holiday_group.xml
@@ -13,5 +13,10 @@
+
+ 假期报表多公司
+
+ [('company_id', 'in', company_ids)]
+
\ No newline at end of file
diff --git a/yuthon_hr_attendance/models/hr_attendance_month.py b/yuthon_hr_attendance/models/hr_attendance_month.py
index c3a3fcc78..72bfdf456 100644
--- a/yuthon_hr_attendance/models/hr_attendance_month.py
+++ b/yuthon_hr_attendance/models/hr_attendance_month.py
@@ -76,10 +76,11 @@ class HrAttendanceMonth(models.Model):
class HrAttendanceMonthDetail(models.Model):
_name = "hr.attendance.month.detail"
_inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin']
- _description = "出勤月度汇总明细"
+ _description = "考勤确认单"
name = fields.Char(related='employee_id.name')
employee_id = fields.Many2one('hr.employee', string="员工", readonly=True)
+ company_id = fields.Many2one(related="employee_id.company_id", string="公司", store=True)
department_id = fields.Many2one('hr.department', string="部门", related="employee_id.department_id", readonly=True)
# userid = fields.Char(string='userid')
attendance_year_id = fields.Many2one('hr.attendance.year', string="统计年份")
diff --git a/yuthon_hr_attendance/security/planning_group.xml b/yuthon_hr_attendance/security/planning_group.xml
index b0873bd40..ca6614887 100644
--- a/yuthon_hr_attendance/security/planning_group.xml
+++ b/yuthon_hr_attendance/security/planning_group.xml
@@ -1,107 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 考勤确认单多公司
+
+ [('company_id', 'in', company_ids)]
+
出勤统计多公司
diff --git a/yuthon_hr_attendance/views/hr_attendance_month_views.xml b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
index 4a015e592..12444f31d 100644
--- a/yuthon_hr_attendance/views/hr_attendance_month_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
@@ -102,6 +102,7 @@
+
diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index fc613c02d..bab7e72b9 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -100,6 +100,7 @@ class InheritHrPayslip(models.Model):
tariff = fields.Float(string='税率')
cumulative_deductions = fields.Float(string='累计减免税额')
amount_tax_withheld = fields.Float(string='累计应扣缴税额')
+ is_bold = fields.Boolean()
remake = fields.Text(string='备注')
# 物管常用项
diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml
index bce3e84fe..2d2fc23a2 100644
--- a/yuthon_salary/views/inherit_hr_payslip_views.xml
+++ b/yuthon_salary/views/inherit_hr_payslip_views.xml
@@ -285,7 +285,7 @@
-
+
@@ -296,7 +296,6 @@
-
@@ -312,6 +311,7 @@
+
@@ -324,6 +324,7 @@
+
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index e81a4bde3..04493a6c9 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -58,6 +58,8 @@ class SalaryComputeWizard(models.Model):
('current_month', '=', self.select_time)])
if detail_id.state == 'unconfirmed':
raise UserError(f'{employee.name}的{self.select_time}考勤还未确认,请先确认考勤再进行工资计算!')
+
+ is_bold = self.check_employee_dates(employee)
contract_id = self.env['hr.contract'].search([('employee_id', '=', employee.id)], limit=1)
year = int(self.select_year)
month = int(self.select_time)
@@ -89,6 +91,7 @@ class SalaryComputeWizard(models.Model):
# if existing_payslip:
# raise UserError( f"员工 {employee.name} 在 {start_date} 到 {end_date} 日期范围内已有工资单记录,无法创建新的工资单。")
payslip = self.env['hr.payslip'].create({
+ 'is_bold':is_bold,
'name': employee.name,
'employee_id': employee.id,
'contract_id': contract_id.id,
@@ -202,4 +205,27 @@ class SalaryComputeWizard(models.Model):
month = month.lstrip('0')
day = day.rstrip('日')
day = day.lstrip('0')
- return f'{month}月{day}日'
\ No newline at end of file
+ return f'{month}月{day}日'
+
+ def check_employee_dates(self, employee):
+ """检查员工入职日期和转正日期的月份是否等于 select_time 的月份"""
+ if not self.select_time:
+ return False # 未选择月份时返回 False
+
+ # 将 select_time 转换为整数(如 '1' → 1)
+ selected_month = int(self.select_time)
+
+ # 检查入职日期月份
+ entry_month_matches = False
+ if employee.entry_date:
+ entry_month = employee.entry_date.month # 获取日期的月份(1-12)
+ entry_month_matches = entry_month == selected_month
+
+ # 检查转正日期月份
+ confirmation_month_matches = False
+ if employee.confirmation_date: # 假设直接使用 employee.confirmation_date 字段
+ conf_month = employee.confirmation_date.month
+ confirmation_month_matches = conf_month == selected_month
+
+ # 满足任一条件即返回 True
+ return entry_month_matches or confirmation_month_matches
\ No newline at end of file
diff --git a/yuthon_salary/wizard/salary_compute_wizard_views.xml b/yuthon_salary/wizard/salary_compute_wizard_views.xml
index f10084cbf..5856f4ec4 100644
--- a/yuthon_salary/wizard/salary_compute_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_compute_wizard_views.xml
@@ -9,9 +9,9 @@
-
+
-
+