From 9708977a02df0ec552bc849d8a3b269df164e499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 24 Mar 2025 11:04:07 +0800 Subject: [PATCH] 1 --- yuthon_salary/models/inherit_hr_payslip.py | 3 ++- yuthon_salary/models/yuthon_payroll_project.py | 18 +++++++++--------- .../views/inherit_hr_payslip_views.xml | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py index 39e126cc1..b76377ffc 100644 --- a/yuthon_salary/models/inherit_hr_payslip.py +++ b/yuthon_salary/models/inherit_hr_payslip.py @@ -4,6 +4,7 @@ from odoo import api, fields, models, _ class InheritHrPayslip(models.Model): _inherit = 'hr.payslip' + employee_id = fields.Many2one('hr.employee', string="姓名") base_salary = fields.Float(string='基本工资', compute='_compute_salary', store=True) identification_id = fields.Char(string='证件号码', related='employee_id.identification_id', store=True) card_type = fields.Char(string='证件类型', store=True, default="居民身份证") @@ -45,7 +46,7 @@ class InheritHrPayslip(models.Model): work_injury_insurance = fields.Float(string='工伤保险费', compute='_compute_salary', store=True) housing_provident_fund = fields.Float(string='住房公积金', compute='_compute_salary', store=True) b_year = fields.Float(string='企业(职业)年金', compute='_compute_salary', store=True) - total_before_tax = fields.Float(string='本期应收', compute='_compute_total_before_tax', store=True) + total_before_tax = fields.Float(string='本期收入', compute='_compute_total_before_tax', store=True) total_before_tax = fields.Float(string='税前合计', compute='_compute_total_before_tax', store=True) year_compute = fields.Float(string='年度清算') year_jie = fields.Float(string='年度结余') diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index e455d2a0d..1d553aef6 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -47,15 +47,15 @@ class YuthonPayrollCommon(models.Model): if ins.name == '工龄工资': formula_salary = "result = (employee.company_old_year + 1) * 10" if ins.name == '工会会费': - formula_salary = "result = contract.wage * -0.05" + formula_salary = "result = contract.wage * 0.05" if ins.name == '误餐费': formula_salary = "result = employee.meal_number * 40" if ins.name == '通讯补贴': formula_salary = "result = 300" - if ins.name == '通讯补贴': - formula_salary = "result = 300" + if ins.name == '全勤奖': + formula_salary = "result = 200 if employee.last_attendance else 0" if ins.name == '加班费': - formula_salary = "result = ((employee.all_overtime_hours - 40) * (payslip.base_salary /21.75 / 8) * 1.5) if employee.all_overtime_hours > 40 else 0" + formula_salary = "result = round(((employee.all_overtime_hours - 40) * (payslip.base_salary /21.75 / 8) * 1.5), 0) if employee.all_overtime_hours > 40 else 0" rule_list.append([0, 0, { 'name': ins.name, 'category_id': self.env['hr.salary.rule.category'].search([('name', '=', '常用项')], limit=1).id, @@ -156,19 +156,19 @@ class YuthonPayrollInsurances (models.Model): if ins.name not in sal.rule_ids.mapped('name'): if ins.name == '基本医疗保险费': number = ins.proportion_employee - formula_salary = "result = employee.last_year_salary * -1 * " + str(number * 0.01) + formula_salary = "result = employee.last_year_salary" + str(number * 0.01) if ins.name == '基本养老保险费': number = ins.proportion_employee - formula_salary = "result = employee.last_year_salary * -1 *" + str(number * 0.01) + formula_salary = "result = employee.last_year_salary" + str(number * 0.01) if ins.name == '失业保险费': number = ins.proportion_employee - formula_salary = "result = employee.last_year_salary * -1 *" + str(number * 0.01) + formula_salary = "result = employee.last_year_salary" + str(number * 0.01) if ins.name == '工伤保险费': number = ins.proportion_employee - formula_salary = "result = employee.last_year_salary * -1 *" + str(number * 0.01) + formula_salary = "result = employee.last_year_salary" + str(number * 0.01) if ins.name == '住房公积金': number = ins.proportion_employee - formula_salary = "result = employee.last_year_salary * -1 *" + str(number * 0.01) + formula_salary = "result = employee.last_year_salary" + str(number * 0.01) rule_list.append([0, 0, { 'name': ins.name, 'category_id': self.env['hr.salary.rule.category'].search([('name', '=', '五险一金')], limit=1).id, diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml index d92f17609..f71cf92fe 100644 --- a/yuthon_salary/views/inherit_hr_payslip_views.xml +++ b/yuthon_salary/views/inherit_hr_payslip_views.xml @@ -40,6 +40,7 @@ + @@ -185,7 +186,7 @@ - +