From e40cf0e5e1bd969b0722e48c056524755efeb5b1 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Fri, 18 Jul 2025 14:35: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
---
yuthon_contract/models/inherit_hr_contract.py | 10 ++++++
.../views/inherit_hr_contract_views.xml | 1 +
.../models/yuthon_vacation_reports.py | 22 ++++++++++++
yuthon_holiday/security/ir.model.access.csv | 1 +
.../views/yuthon_vacation_reports_views.xml | 36 +++++++++++++++++++
.../models/yuthon_payroll_project.py | 8 ++---
yuthon_salary/wizard/salary_compute_wizard.py | 4 +--
7 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py
index c842310f1..56e8f9937 100644
--- a/yuthon_contract/models/inherit_hr_contract.py
+++ b/yuthon_contract/models/inherit_hr_contract.py
@@ -11,6 +11,7 @@ class HrContract(models.Model):
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('contract_code'))
name = fields.Char(string="合同名称", compute='_compute_name', readonly=False)
+ is_annual_salary = fields.Boolean(string="是否年薪")
resource_calendar_id = fields.Many2one('resource.calendar', string='考勤时间表')
state = fields.Selection([
('draft', '草稿'),
@@ -205,6 +206,15 @@ class HrContract(models.Model):
else:
employee.salary_group_id = False
+ @api.onchange('is_annual_salary')
+ def _compute_is_annual_salary(self):
+ for contract_id in self:
+ employee = self.env['hr.employee'].search([('id', '=', contract_id.employee_id.id)], limit=1)
+ if employee:
+ employee.is_annual_salary = contract_id.is_annual_salary
+ else:
+ employee.is_annual_salary = False
+
@api.model
def create(self, vals):
contract = super(HrContract, self).create(vals)
diff --git a/yuthon_contract/views/inherit_hr_contract_views.xml b/yuthon_contract/views/inherit_hr_contract_views.xml
index 07758935b..668819f43 100644
--- a/yuthon_contract/views/inherit_hr_contract_views.xml
+++ b/yuthon_contract/views/inherit_hr_contract_views.xml
@@ -42,6 +42,7 @@
+
diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py
index 37ee05916..bf4bf9c40 100644
--- a/yuthon_holiday/models/yuthon_vacation_reports.py
+++ b/yuthon_holiday/models/yuthon_vacation_reports.py
@@ -14,6 +14,7 @@ class YuthonVacationReports(models.Model):
leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细')
overtime_ids = fields.One2many('vacation.over.line', 'vacation_id', string='加班明细')
meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细')
+ medical_fee_ids = fields.One2many('vacation.medical.line', 'vacation_id', string='体检费明细')
leave = fields.Float(string='年假', compute='_compute_leave', store=True)
working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True)
@@ -218,6 +219,8 @@ class VacationLeaveLine(models.Model):
update_lines = fields.Float(string='更新额度')
is_void = fields.Boolean(string='是否作废')
allocation_type = fields.Selection([('vacation', '休假'), ('allocation', '分配')], string='分配类型')
+ valid_date = fields.Date(string='有效期至')
+ adjust_date = fields.Date(string='调整至')
text = fields.Text(string='备注')
@api.model
@@ -258,6 +261,8 @@ class VacationOverline(models.Model):
meal_number = fields.Integer(string='误餐次数')
update_date = fields.Date(string='更新时间')
is_void = fields.Boolean(string='是否作废')
+ valid_date = fields.Date(string='有效期至')
+ adjust_date = fields.Date(string='调整至')
text = fields.Text(string='备注')
# def _sync_to_employee(self, reverse=False):
@@ -304,6 +309,8 @@ class VacationMealLine(models.Model):
update_lines = fields.Float(string='更新额度')
is_soon = fields.Boolean(string="流程修改")
is_void = fields.Boolean(string='是否作废', default=False)
+ valid_date = fields.Date(string='有效期至')
+ adjust_date = fields.Date(string='调整至')
is_manual = fields.Boolean(string="手动修改")
text = fields.Text(string='备注')
@@ -333,6 +340,21 @@ class VacationMealLine(models.Model):
self._sync_to_employee(reverse=True)
return super(VacationMealLine, self).unlink()
+
+class VacationMedicalLine(models.Model):
+ _name = 'vacation.medical.line'
+ _description = '体检费明细'
+
+ vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
+ employee_id = fields.Many2one('hr.employee', string='员工')
+ workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
+ update_type = fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
+ update_date = fields.Date(string='更新时间')
+ valid_date = fields.Date(string='有效期至')
+ adjust_date = fields.Date(string='调整至')
+ is_void = fields.Boolean(string='是否作废', default=False)
+ text = fields.Text(string='备注')
+
class DetailsTree(models.Model):
_name = 'details.tree'
_description = '明细表'
diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv
index 07834f674..2b531e9b0 100644
--- a/yuthon_holiday/security/ir.model.access.csv
+++ b/yuthon_holiday/security/ir.model.access.csv
@@ -11,3 +11,4 @@ access_vacation_leave_line,vacation_leave_line,model_vacation_leave_line,base.gr
access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group_user,1,1,1,1
access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1
access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1
+access_vacation_medical_line,vacation_medical_line,model_vacation_medical_line,base.group_user,1,1,1,1
diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
index 14277fe92..3d8c9ad47 100644
--- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml
+++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
@@ -43,6 +43,8 @@
+
+
@@ -62,6 +64,8 @@
+
+
@@ -78,12 +82,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -166,6 +187,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py
index 75526a89b..18b6e3545 100644
--- a/yuthon_salary/models/yuthon_payroll_project.py
+++ b/yuthon_salary/models/yuthon_payroll_project.py
@@ -64,17 +64,17 @@ class YuthonPayrollCommon(models.Model):
if ins.name == '工龄工资' and ins.company_id.name == '天河物管':
formula_salary = "result = employee.company_old_year * 10 if employee.company_old_year >= 1 and employee.department_id.name != '领导班子' else 0"
if ins.name == '工龄工资' and ins.company_id.name == '集团本部':
- formula_salary = "result = 0 if (employee.is_annual_salary or employee.salary_group_id.name in ['天投城建劳务外派', '天投城建退休']) else (employee.company_old_year * 10)"
+ formula_salary = "result = 0 if (employee.is_annual_salary or '劳务' in (employee.contract_id.structure_type_id.name or '') or '工勤返聘' in (employee.contract_id.structure_type_id.name or '')) else (employee.company_old_year * 10)"
if ins.name == '误餐费':
formula_salary = "result = employee.meal_number * 40 + employee.meal_supplement"
if ins.name == '通讯补贴':
- formula_salary = "result = 0 if (employee.is_annual_salary or employee.salary_group_id.name in ['天投城建劳务外派', '天投城建退休']) else 300"
+ formula_salary = "result = 0 if (employee.is_annual_salary or '劳务' in (employee.contract_id.structure_type_id.name or '') or '工勤返聘' in (employee.contract_id.structure_type_id.name or '')) else 300"
if ins.name == '全勤奖' and ins.company_id.name == '集团本部':
- formula_salary = "result = 0 if (employee.is_annual_salary or employee.salary_group_id.name in ['天投城建外派', '天投城建退休']) else (200 if employee.last_attendance else 0)"
+ formula_salary = "result = 0 if (employee.is_annual_salary or '劳务' in (employee.contract_id.structure_type_id.name or '') or '工勤返聘' in (employee.contract_id.structure_type_id.name or '')) else (200 if employee.last_attendance else 0)"
if ins.name == '全勤奖' and ins.company_id.name == '天河物管':
formula_salary = "result = 100 if employee.last_attendance else 0"
if ins.name == '加班费':
- formula_salary = "result = 0 if (employee.is_annual_salary or employee.salary_group_id.name == '天投城建工勤人员') else (round(((employee.all_overtime_hours - 40) * (payslip.base_salary / 21.75 / 8) * 1.5), 0) if employee.all_overtime_hours > 40 else 0)"
+ formula_salary = "result = 0 if (employee.is_annual_salary or employee.contract_id.structure_type_id.name == '工勤返聘') else (round(((employee.all_overtime_hours - 40) * (payslip.base_salary / 21.75 / 8) * 1.5), 0) if employee.all_overtime_hours > 40 else 0)"
if ins.name == '安全生产管理补贴':
formula_salary = "result = employee.security_amount "
if ins.name == '工龄补贴' and ins.company_id.name == '天河物管':
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index ccb3b1356..f6e1fc1ae 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -137,8 +137,8 @@ class SalaryComputeWizard(models.Model):
employee = internship_id.employee_id
contract = employee.contract_id
- # 集团本部 岗位工资只有退休才用值
- if contract.salary_group_id.name == '天投城建退休' and self.company_id.name == '集团本部':
+ # 集团本部 岗位工资除了工勤返聘才用值
+ if contract.structure_type_id.name == '工勤返聘' and self.company_id.name == '集团本部':
for line in internship_id.line_ids:
if line.name == '岗位工资':
line.total = 0