From 375a6ee4ff1dd1ef32db234958667876844fb710 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Tue, 20 May 2025 18:51:56 +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 | 19 +++++++++++++++++++ .../models/yuthon_payroll_project.py | 17 +++++++++++++++++ .../views/inherit_hr_payslip_views.xml | 1 + .../views/yuthon_payroll_project_views.xml | 3 +++ 4 files changed, 40 insertions(+) diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index 67e5cf146..c7f693e32 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -250,6 +250,25 @@ class InheritHrPayslip(models.Model): record.base_salary_deduction ) + def compute_salary_1(self): + all_fields = self._fields + + # 筛选出Float类型的字段(排除不需要处理的字段) + excluded_fields = [ + 'id', 'create_uid', 'create_date', 'write_uid', 'write_date', + # 添加其他不需要处理的字段(如关系字段、状态字段等) + ] + float_fields = [ + field_name + for field_name, field in all_fields.items() + if isinstance(field, fields.Float) and field_name not in excluded_fields + ] + for record in self: + for field in float_fields: + if hasattr(record, field) and getattr(record, field): + setattr(record, field, getattr(record, field) / 80) + + @api.depends('total_before_tax', 'basic_endowment_insurance', 'basic_medical_insurance', 'unemployment_insurance', 'housing_provident_fund', 'b_year', 'tax_payable', 'union_dues', 'meal_misunderstanding_fee', 'temporary_performance_bonus', diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 04c0d1fbf..2d3fd1e68 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -211,3 +211,20 @@ class YuthonPayrollInsurances (models.Model): sal.rule_ids.search([('name', '=', ins.name)]).write({'amount_python_compute': formula_salary}) + def compute_salary_1(self): + all_fields = self._fields + + # 筛选出Float类型的字段(排除不需要处理的字段) + excluded_fields = [ + 'id', 'create_uid', 'create_date', 'write_uid', 'write_date', + # 添加其他不需要处理的字段(如关系字段、状态字段等) + ] + float_fields = [ + field_name + for field_name, field in all_fields.items() + if isinstance(field, fields.Float) and field_name not in excluded_fields + ] + for record in self: + for field in float_fields: + if hasattr(record, field) and getattr(record, field): + setattr(record, field, getattr(record, field) / 80) \ 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 ae905c367..9c904cfb0 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -257,6 +257,7 @@
+