!2050 !2049 Merge branch 'dev' into dev_zhou

Merge pull request !2050 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-03-24 06:49:16 +00:00
committed by Gitee
8 changed files with 77 additions and 16 deletions
@@ -76,7 +76,8 @@ class YuthonHrEmployee(models.Model):
entry_date = fields.Date(string="入职时间")
confirmation_date = fields.Date(string="转正时间")
company_old = fields.Char(string="司龄", compute='_compute_company_old')
company_old_year = fields.Integer(string="司龄(年)", compute='_compute_company_old')
company_old_year = fields.Integer(string="司龄(年)", compute='_compute_company_old', store=True)
regularization_year = fields.Integer(string="转正(年)", compute='_compute_regularization_year', store=True)
open_start_time = fields.Date(string="参加工作时间")
cumulative_work_month = fields.Integer(string="累计工作月数", compute='_compute_social_insurance_info', store=True)
cumulative_work_years = fields.Char(string="累计工作年限", compute='_compute_cumulative_work_years', store=True)
@@ -289,6 +290,12 @@ class YuthonHrEmployee(models.Model):
"target": "new",
}
@api.depends('confirmation_date')
def _compute_regularization_year(self):
for record in self:
if record.confirmation_date:
record.regularization_year = fields.Date.today().year - record.confirmation_date.year()
@api.depends('entry_date')
def _compute_company_old(self):
"""司龄计算"""
@@ -118,6 +118,7 @@
<field name="confirmation_date"/>
<field name="company_old"/>
<field name="company_old_year" invisible="1"/>
<field name="regularization_year" invisible="1"/>
<field name="open_start_time"/>
<field name="cumulative_work_month"/>
<field name="cumulative_work_years"/>
+10 -1
View File
@@ -47,7 +47,7 @@ class InheritHrPayslip(models.Model):
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_tax = fields.Float(string='本期应收', compute='_compute_total_before_tax', store=True)
year_compute = fields.Float(string='年度清算')
year_jie = fields.Float(string='年度结余')
year_gong = fields.Float(string='年功奖')
@@ -60,6 +60,15 @@ class InheritHrPayslip(models.Model):
is_push = fields.Boolean(string='推送')
is_salary_push = fields.Boolean(string='工资推送')
commercial_health_insurance = fields.Float(string='商业健康保险')
tax_deferred_pension_insurance = fields.Float(string='税延养老保险')
others = fields.Float(string='其他')
deductible_donations = fields.Float(string='准予扣除的捐赠额')
total_pre_tax_deductions = fields.Float(string='税前扣除项目合计')
tax_reduction = fields.Float(string='减免税额')
deduction_standard = fields.Float(string='减除费用标准')
paid_tax = fields.Float(string='已缴税额')
@api.depends('line_ids')
def _compute_salary(self):
for rec in self:
@@ -47,11 +47,13 @@ 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 = payslip.base_salary * 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 = employee.last_year_salary * 0.02 if employee.confirmation_year >= 1 else ((payslip.base_salary + payslip.rank_salary) * 0.02)"
if ins.name == '全勤奖':
formula_salary = "result = 200 if employee.last_attendance else 0"
if ins.name == '加班费':
@@ -156,19 +158,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" + 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" + 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" + 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" + 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" + 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,
@@ -64,9 +64,6 @@
<field name="name">工资单公司过滤</field>
<field name="model_id" ref="model_hr_payslip"/>
<field name="domain_force">[('yuthon_company', '=', user.employee_id.yuthon_company)]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
<field name="groups" eval="[(4, ref('group_salary_user')), (4, ref('group_salary_admin'))]"/>
</record>
</odoo>
@@ -136,6 +136,14 @@
<field name="year_gong" invisible="1"/>
<field name="study_on" invisible="1"/>
<field name="jing_te" invisible="1"/>
<field name="commercial_health_insurance" invisible="1"/>
<field name="tax_deferred_pension_insurance" invisible="1"/>
<field name="others" invisible="1"/>
<field name="deductible_donations" invisible="1"/>
<field name="total_pre_tax_deductions" invisible="1"/>
<field name="tax_reduction" invisible="1"/>
<field name="deduction_standard" invisible="1"/>
<field name="paid_tax" invisible="1"/>
<!-- <field name="salary_group_id" invisible="1"/>-->
</group>
</group>
@@ -198,6 +206,14 @@
<field name="housing_rent"/>
<field name="continuing_education"/>
<field name="infant_care"/>
<field name="commercial_health_insurance"/>
<field name="tax_deferred_pension_insurance"/>
<field name="others"/>
<field name="deductible_donations"/>
<field name="total_pre_tax_deductions"/>
<field name="tax_reduction"/>
<field name="deduction_standard"/>
<field name="paid_tax"/>
<field name="is_push" column_invisible="1"/>
<field name="is_salary_push" column_invisible="1"/>
<button name="return_button" string="退回" type="object" class="oe_highlight"/>
@@ -74,6 +74,5 @@ class SalaryComputeWizard(models.Model):
payslip.compute_sheet()
def _get_chinese_month(self, month):
chinese_months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月',
'十二月']
chinese_months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
return chinese_months[month - 1]
+32 -2
View File
@@ -19,6 +19,36 @@ class SalaryPayslipWizard(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_data(row)
def yuthon_payroll_tt_data(self, row):
pass
def yuthon_payroll_data(self, row):
employee_id = self.env['hr.employee'].search([('name', '=', row[1].value)])
payslip_run_id = self.env['hr.payslip.run'].search([('name', '=', '2025年-1月')])
if not payslip_run_id:
payslip_run_id = self.env['hr.payslip.run'].create({
'name': '2025年-1月',
'date_start': '2025-01-01',
'date_end': '2025-01-31',
'state': 'draft',
'payslip_count': 0
})
self.env['hr.payslip'].create({
'name': employee_id.name,
'employee_id': employee_id.id,
'payslip_run_id': payslip_run_id.id,
'state': 'draft',
'date_from': '2025-01-01',
'date_to': '2025-01-31',
'commercial_health_insurance': row[20].value,
'tax_deferred_pension_insurance': row[21].value,
'others': row[22].value,
'deductible_donations': row[23].value,
'total_pre_tax_deductions': row[24].value,
'tax_reduction': row[25].value,
'deduction_standard': row[26].value,
'paid_tax': row[27].value,
'is_push': True,
'is_salary_push':False
})