diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index 0a3215461..e16e073fe 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -76,7 +76,8 @@ class YuthonHrEmployee(models.Model):
entry_date = fields.Date(string="入职时间")
confirmation_date = fields.Date(string="转正时间")
company_old = fields.Char(string="司龄", compute='_compute_company_old')
- company_old_year = fields.Integer(string="司龄(年)", compute='_compute_company_old')
+ company_old_year = fields.Integer(string="司龄(年)", compute='_compute_company_old', store=True)
+ regularization_year = fields.Integer(string="转正(年)", compute='_compute_regularization_year', store=True)
open_start_time = fields.Date(string="参加工作时间")
cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_social_insurance_info', store=True)
cumulative_work_years = fields.Char(string="累计工作年限", compute='_compute_cumulative_work_years', store=True)
@@ -289,6 +290,12 @@ class YuthonHrEmployee(models.Model):
"target": "new",
}
+ @api.depends('confirmation_date')
+ def _compute_regularization_year(self):
+ for record in self:
+ if record.confirmation_date:
+ record.regularization_year = fields.Date.today().year - record.confirmation_date.year()
+
@api.depends('entry_date')
def _compute_company_old(self):
"""司龄计算"""
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index 8a2573cf8..d6be47590 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -118,6 +118,7 @@
+
diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py
index 1d553aef6..af60c8ff9 100644
--- a/yuthon_salary/models/yuthon_payroll_project.py
+++ b/yuthon_salary/models/yuthon_payroll_project.py
@@ -47,11 +47,13 @@ class YuthonPayrollCommon(models.Model):
if ins.name == '工龄工资':
formula_salary = "result = (employee.company_old_year + 1) * 10"
if ins.name == '工会会费':
- formula_salary = "result = contract.wage * 0.05"
+ formula_salary = "result = payslip.base_salary * 0.05"
if ins.name == '误餐费':
formula_salary = "result = employee.meal_number * 40"
if ins.name == '通讯补贴':
formula_salary = "result = 300"
+ if ins.name == '企业(职业)年金':
+ formula_salary = "result = employee.last_year_salary * 0.02 if employee.confirmation_year >= 1 else ((payslip.base_salary + payslip.rank_salary) * 0.02)"
if ins.name == '全勤奖':
formula_salary = "result = 200 if employee.last_attendance else 0"
if ins.name == '加班费':
@@ -156,19 +158,19 @@ class YuthonPayrollInsurances (models.Model):
if ins.name not in sal.rule_ids.mapped('name'):
if ins.name == '基本医疗保险费':
number = ins.proportion_employee
- formula_salary = "result = employee.last_year_salary" + str(number * 0.01)
+ formula_salary = "result = employee.last_year_salary * " + str(number * 0.01)
if ins.name == '基本养老保险费':
number = ins.proportion_employee
- formula_salary = "result = employee.last_year_salary" + str(number * 0.01)
+ formula_salary = "result = employee.last_year_salary * " + str(number * 0.01)
if ins.name == '失业保险费':
number = ins.proportion_employee
- formula_salary = "result = employee.last_year_salary" + str(number * 0.01)
+ formula_salary = "result = employee.last_year_salary * " + str(number * 0.01)
if ins.name == '工伤保险费':
number = ins.proportion_employee
- formula_salary = "result = employee.last_year_salary" + str(number * 0.01)
+ formula_salary = "result = employee.last_year_salary * " + str(number * 0.01)
if ins.name == '住房公积金':
number = ins.proportion_employee
- formula_salary = "result = employee.last_year_salary" + str(number * 0.01)
+ formula_salary = "result = employee.last_year_salary * " + str(number * 0.01)
rule_list.append([0, 0, {
'name': ins.name,
'category_id': self.env['hr.salary.rule.category'].search([('name', '=', '五险一金')], limit=1).id,
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index e7f4e3b86..e51052c3c 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -74,6 +74,5 @@ class SalaryComputeWizard(models.Model):
payslip.compute_sheet()
def _get_chinese_month(self, month):
- chinese_months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月',
- '十二月']
+ chinese_months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
return chinese_months[month - 1]
\ No newline at end of file