This commit is contained in:
李鹏宇
2025-03-24 11:04:07 +08:00
parent 7311402ae9
commit 9708977a02
3 changed files with 13 additions and 11 deletions
+2 -1
View File
@@ -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='年度结余')
@@ -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,
@@ -40,6 +40,7 @@
<field name="basic_medical_insurance"/>
<field name="basic_endowment_insurance"/>
<field name="unemployment_insurance"/>
<field name="b_year"/>
<field name="tax"/>
<field name="housing_provident_fund"/>
<field name="union_dues"/>
@@ -185,7 +186,7 @@
<field name="struct_id" string="职级"/>
<field name="card_type"/>
<field name="identification_id"/>
<field name="total_before_tax"/>
<field name="total_before_tax" string="本期收入"/>
<field name="basic_endowment_insurance"/>
<field name="basic_medical_insurance"/>
<field name="unemployment_insurance"/>