diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index 576d21eeb..8a28c2262 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -148,7 +148,7 @@ - + diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index dabdb194b..4d1f6eba8 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -129,7 +129,10 @@ class InheritHrPayslip(models.Model): payslip_records = self.browse(self._context.get('active_ids', self._context.get('active_id'))) payslips = payslip_records or self # 过滤出状态为草稿或已验证的工资单 - payslips = payslips.filtered(lambda slip: slip.state in ['draft', 'verify']) + payslips = payslips.filtered( + lambda slip: slip.state in ['draft', 'verify'] + and slip.employee_id.contract_id.is_probation + ) # delete old payslip lines payslips.line_ids.unlink() # this guarantees consistent results diff --git a/yuthon_salary/views/salary_payroll_distribution_viwes.xml b/yuthon_salary/views/salary_payroll_distribution_viwes.xml index 4e14bff48..ca24a58cd 100644 --- a/yuthon_salary/views/salary_payroll_distribution_viwes.xml +++ b/yuthon_salary/views/salary_payroll_distribution_viwes.xml @@ -7,7 +7,7 @@ - + diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py index 7d27a17fa..8885b0bb8 100644 --- a/yuthon_salary/wizard/salary_compute_wizard.py +++ b/yuthon_salary/wizard/salary_compute_wizard.py @@ -3,6 +3,7 @@ from odoo import models, fields, api, _, SUPERUSER_ID from odoo.exceptions import ValidationError, UserError from odoo.exceptions import ValidationError from pypinyin import pinyin, Style +import math import xlrd import base64 import datetime @@ -56,7 +57,7 @@ class SalaryComputeWizard(models.Model): # f"在 {self.select_year} 年 {self.select_time} 月没有出勤月度汇总记录,请先完成考勤统计。") # if not all(record.is_state for record in attendance_records): # raise ValidationError( - # f"在 {self.select_year} 年 {self.select_time} 月的出勤月度汇总记录未全部确认,请先确认考勤。") + # f"在 {self.select_year} 年 {self.select_time} 月的出勤月度汇总记录未全部确认,请先确认考勤。" for employee in self.employee_ids: contract_id = self.env['hr.contract'].search([('employee_id', '=', employee.id)], limit=1) year = int(self.select_year) @@ -140,15 +141,14 @@ class SalaryComputeWizard(models.Model): if field_name == 'performance_bonuses': result = 0 elif field_name in ['commuting_allowance', 'seniority_salary']: - if work_days != days: - result = line.total * internship_days / days + line.total * work_days / days - else: - result = line.total * internship_days / days + result = line.total * internship_days / days + line.total * work_days / days + elif field_name in ['base_salary', 'rank_salary']: + base_value = line.total + if base_value % 1 != 0: + base_value = math.ceil(base_value) + result = base_value * 0.8 * internship_days / days + line.total * work_days / days else: - if work_days != days: - result = line.total * 0.8 * internship_days / days + line.total * work_days / days - else: - result = line.total * 0.8 * internship_days / days + result = line.total * 0.8 * internship_days / days + line.total * work_days / days setattr(internship_id, field_name, result) line.write({'total': result})