From a2c5c6dabf28e7cc507ce31eeac4fb09b4e2acb8 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Fri, 18 Apr 2025 15:30:40 +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_payroll_structure.py | 10 +++++-----
.../views/inherit_hr_payroll_structure_views.xml | 2 ++
yuthon_salary/wizard/yuthon_payroll_wizard.py | 5 ++++-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py
index f024c7913..57626597d 100644
--- a/yuthon_salary/models/inherit_hr_payroll_structure.py
+++ b/yuthon_salary/models/inherit_hr_payroll_structure.py
@@ -24,6 +24,7 @@ class HrPayrollStructure(models.Model):
position_salary = fields.Monetary(string="岗位工资", currency_field="currency_id")
position_subsidy = fields.Monetary(string="岗位补贴", currency_field="currency_id")
integrated_subsidy = fields.Monetary(string="综合补贴", currency_field="currency_id")
+ full_attendance_bonus = fields.Monetary(string="全勤奖金", currency_field="currency_id")
advance_performance_bonuses = fields.Monetary(string="预发绩效奖金", currency_field="currency_id")
@api.model
@@ -96,6 +97,10 @@ class HrPayrollStructure(models.Model):
def _onchange_advance_performance_bonuses(self):
self._handle_salary_rule('预发绩效奖金', self.advance_performance_bonuses)
+ @api.onchange('full_attendance_bonus')
+ def _onchange_full_attendance_bonus(self):
+ self._handle_salary_rule('全勤奖', self.full_attendance_bonus)
+
def open_record(self):
return {
"type": "ir.actions.act_window",
@@ -141,11 +146,6 @@ class HrPayrollStructure(models.Model):
def salary_rule_data(self):
# 定义不同公司的字段映射
company_mappings = {
- 'thtz': { # 天河投资
- '基本工资': 'base_salary',
- '职级工资': 'rank_salary',
- '预发绩效奖金': 'advance_performance_bonuses'
- },
'thwg': { # 天河物管
'基本工资': 'base_salary',
'岗位工资': 'position_salary',
diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
index cba38e241..482d28930 100644
--- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
+++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml
@@ -35,6 +35,7 @@
+
@@ -55,6 +56,7 @@
+
diff --git a/yuthon_salary/wizard/yuthon_payroll_wizard.py b/yuthon_salary/wizard/yuthon_payroll_wizard.py
index 9219f1084..bb5c7ce34 100644
--- a/yuthon_salary/wizard/yuthon_payroll_wizard.py
+++ b/yuthon_salary/wizard/yuthon_payroll_wizard.py
@@ -22,6 +22,9 @@ class YuthonPayrollWizard(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_wg_data(row)
# if sh.row(1)[6].value == 'thtz':
# salary_rule_model = self.env['hr.salary.rule']
# all_rules = salary_rule_model.search([])
@@ -52,7 +55,7 @@ class YuthonPayrollWizard(models.Model):
})
def yuthon_payroll_wg_data(self, row):
- type_id = self.env['hr.payroll.structure.type'].search([('name', '=', row[0].value)])
+ type_id = self.env['hr.payroll.structure.type'].search([('name', '=', row[0].value)], limit=1)
base_salary = row[1].value
position_salary = row[2].value
integrated_subsidy = row[3].value