Merge pull request !4160 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-07-29 14:25:57 +00:00
committed by Gitee
2 changed files with 25 additions and 7 deletions
+19 -1
View File
@@ -181,6 +181,24 @@ class InheritHrPayslip(models.Model):
if record.minus_annuity_difference > 0:
record.minus_annuity_difference = -record.minus_annuity_difference
def _process_fields(self, values):
fields_to_process = [
'minus_annuity_difference',
'individual_income_tax',
'minus_att',
'retroactive_insurance',
'tax_payable'
]
for field in fields_to_process:
if field in values:
# 处理逻辑:取绝对值后减1
values[field] = abs(values[field]) * -1
return values
def write(self, values):
values = self._process_fields(values)
return super(InheritHrPayslip, self).write(values)
@api.onchange('line_ids')
def _onchange_line_ids(self):
for line in self.line_ids:
@@ -449,7 +467,7 @@ class InheritHrPayslip(models.Model):
if line.name == '年金':
rec.annuity = line.total
rec.three_one = rec.housing_provident_fund + rec.work_injury_insurance + rec.basic_endowment_insurance + rec.basic_medical_insurance + rec.unemployment_insurance + rec.social_security
rec.three_one = (rec.housing_provident_fund + rec.work_injury_insurance + rec.basic_endowment_insurance + rec.basic_medical_insurance + rec.unemployment_insurance + rec.social_security) * -1
def basic_pension_wizard(self):
return {
@@ -100,12 +100,12 @@ class YuthonPayrollCommon(models.Model):
if ins.name == '质检员津贴':
formula_salary = "result = employee.quality_inspector_amount"
if ins.name == '工会会费' and ins.company_id.name in ['集团本部', '天河物管']:
formula_salary = "result = round((payslip.base_salary * 0.005), 2)"
formula_salary = "result = round(abs(payslip.base_salary * 0.005) * -1, 2)"
if ins.name == '工会会费' and ins.company_id.name == '天河粮储':
formula_salary = "result = 20 if employee.user_role_id.name in ['总经理', '副总经理'] else \
formula_salary = "result = abs(20 if employee.user_role_id.name in ['总经理', '副总经理'] else \
15 if employee.user_role_id.name in ['部门经理', '部门副经理'] else \
5 if employee.job_id.name == '工勤' else \
10"
10) * -1"
if ins.name == '岗位补贴':
formula_salary = "result = employee.subsidy_amount"
@@ -233,13 +233,13 @@ class YuthonPayrollInsurances (models.Model):
if ins.name == '企业(职业)年金':
if ins.company_id.name == '天河物管':
code = 'WGQYNJ'
formula_salary = "result = 0.0 if employee.total_coefficients == 0 else round((employee.converted/employee.total_coefficients * employee.calculation_totals * 0.08 * 0.5)/12, 2)"
formula_salary = "result = 0.0 if employee.total_coefficients == 0 else round(abs((employee.converted/employee.total_coefficients * employee.calculation_totals * 0.08 * 0.5)/12) * -1, 2)"
elif ins.company_id.name == '集团本部':
code = 'QYNJ'
formula_salary = "result = round((employee.last_year_salary * 0.02), 0)"
formula_salary = "result = round(abs(employee.last_year_salary * 0.02) * -1, 0)"
else:
code = 'LCQYNJ'
formula_salary = "result = round((employee.last_year_salary * 0.02), 2)"
formula_salary = "result = round(abs(employee.last_year_salary * 0.02) * -1, 2)"
if ins.name not in sal.rule_ids.mapped('name'):
rule_list.append([0, 0, {
'name': ins.name,