From 334044151450978a9a6b12bb968f1b3a778fee72 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Tue, 29 Jul 2025 22:21:26 +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_salary/models/inherit_hr_payslip.py | 20 ++++++++++++++++++- .../models/yuthon_payroll_project.py | 12 +++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index 16ae7df28..959c8806b 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -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 { diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 8c66c244c..33b01df16 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -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,