添加功能

This commit is contained in:
zhou
2025-04-18 15:30:40 +08:00
parent e2c72884e0
commit a2c5c6dabf
3 changed files with 11 additions and 6 deletions
@@ -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',
@@ -35,6 +35,7 @@
<field name="communication_subsidy"/>
<field name="position_salary"/>
<field name="advance_performance_bonuses"/>
<field name="full_attendance_bonus" column_invisible="1"/>
<field name="create_time"/>
<field name="end_time"/>
<field name="is_enable"/>
@@ -55,6 +56,7 @@
<field name="is_enable"/>
<field name="base_salary" invisible="1"/>
<field name="rank_salary" invisible="1"/>
<field name="full_attendance_bonus" invisible="1"/>
<field name="advance_performance_bonuses" invisible="1"/>
<field name="communication_subsidy" invisible="1"/>
<field name="position_salary" invisible="1"/>
@@ -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