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/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index b76377ffc..ef73abe66 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -47,7 +47,7 @@ class InheritHrPayslip(models.Model):
housing_provident_fund = fields.Float(string='住房公积金', compute='_compute_salary', store=True)
b_year = fields.Float(string='企业(职业)年金', compute='_compute_salary', store=True)
total_before_tax = fields.Float(string='本期收入', compute='_compute_total_before_tax', store=True)
- total_before_tax = fields.Float(string='税前合计', compute='_compute_total_before_tax', store=True)
+ total_tax = fields.Float(string='本期应收', compute='_compute_total_before_tax', store=True)
year_compute = fields.Float(string='年度清算')
year_jie = fields.Float(string='年度结余')
year_gong = fields.Float(string='年功奖')
@@ -60,6 +60,15 @@ class InheritHrPayslip(models.Model):
is_push = fields.Boolean(string='推送')
is_salary_push = fields.Boolean(string='工资推送')
+ commercial_health_insurance = fields.Float(string='商业健康保险')
+ tax_deferred_pension_insurance = fields.Float(string='税延养老保险')
+ others = fields.Float(string='其他')
+ deductible_donations = fields.Float(string='准予扣除的捐赠额')
+ total_pre_tax_deductions = fields.Float(string='税前扣除项目合计')
+ tax_reduction = fields.Float(string='减免税额')
+ deduction_standard = fields.Float(string='减除费用标准')
+ paid_tax = fields.Float(string='已缴税额')
+
@api.depends('line_ids')
def _compute_salary(self):
for rec in self:
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/security/yuthon_salary_group.xml b/yuthon_salary/security/yuthon_salary_group.xml
index 2f9fc0190..d282b1578 100644
--- a/yuthon_salary/security/yuthon_salary_group.xml
+++ b/yuthon_salary/security/yuthon_salary_group.xml
@@ -64,9 +64,6 @@
工资单公司过滤
[('yuthon_company', '=', user.employee_id.yuthon_company)]
-
-
-
-
+
\ No newline at end of file
diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml
index f11efd806..04c0f218b 100644
--- a/yuthon_salary/views/inherit_hr_payslip_views.xml
+++ b/yuthon_salary/views/inherit_hr_payslip_views.xml
@@ -136,6 +136,14 @@
+
+
+
+
+
+
+
+
@@ -198,6 +206,14 @@
+
+
+
+
+
+
+
+
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
diff --git a/yuthon_salary/wizard/salary_payslip_wizard.py b/yuthon_salary/wizard/salary_payslip_wizard.py
index cd3b8855f..35f0b7bcc 100644
--- a/yuthon_salary/wizard/salary_payslip_wizard.py
+++ b/yuthon_salary/wizard/salary_payslip_wizard.py
@@ -19,6 +19,36 @@ class SalaryPayslipWizard(models.Model):
raise ValidationError('请上传文件。')
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
sh = book.sheet_by_index(0)
+ for rx in range(1, sh.nrows):
+ row = sh.row(rx)
+ self.yuthon_payroll_data(row)
- def yuthon_payroll_tt_data(self, row):
- pass
\ No newline at end of file
+ def yuthon_payroll_data(self, row):
+ employee_id = self.env['hr.employee'].search([('name', '=', row[1].value)])
+ payslip_run_id = self.env['hr.payslip.run'].search([('name', '=', '2025年-1月')])
+ if not payslip_run_id:
+ payslip_run_id = self.env['hr.payslip.run'].create({
+ 'name': '2025年-1月',
+ 'date_start': '2025-01-01',
+ 'date_end': '2025-01-31',
+ 'state': 'draft',
+ 'payslip_count': 0
+ })
+ self.env['hr.payslip'].create({
+ 'name': employee_id.name,
+ 'employee_id': employee_id.id,
+ 'payslip_run_id': payslip_run_id.id,
+ 'state': 'draft',
+ 'date_from': '2025-01-01',
+ 'date_to': '2025-01-31',
+ 'commercial_health_insurance': row[20].value,
+ 'tax_deferred_pension_insurance': row[21].value,
+ 'others': row[22].value,
+ 'deductible_donations': row[23].value,
+ 'total_pre_tax_deductions': row[24].value,
+ 'tax_reduction': row[25].value,
+ 'deduction_standard': row[26].value,
+ 'paid_tax': row[27].value,
+ 'is_push': True,
+ 'is_salary_push':False
+ })