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