Merge pull request !3830 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-07-14 03:54:08 +00:00
committed by Gitee
4 changed files with 19 additions and 21 deletions
+2 -4
View File
@@ -36,7 +36,7 @@ class InheritHrPayslip(models.Model):
child_education = fields.Float(string='累计子女教育')
tax = fields.Float(string="税金")
retroactive_allowance = fields.Float(string="补发津贴")
condolence_fund = fields.Float(string="儿童节慰问金")
condolence_fund = fields.Float(string="儿童节慰问金") # 物管
continuing_education = fields.Float(string='累计继续教育')
elderly_support = fields.Float(string='累计赡养老人')
infant_care = fields.Float(string='累计3岁以下婴幼儿照护')
@@ -63,7 +63,7 @@ class InheritHrPayslip(models.Model):
total_before_tax = fields.Float(string='本期应收', compute='_compute_total_before_tax', store=True)
year_compute = fields.Float(string='前年年度清算', store=True)
year_jie = fields.Float(string='前年年度结余', store=True)
children_welfare_fee = fields.Float(string='六一儿童节福利')
children_welfare_fee = fields.Float(string='儿童节慰问金') # 天河
year_gong = fields.Float(string='年功奖', store=True)
study_on = fields.Float(string='学习进步奖')
jing_te = fields.Float(string='经营特别奖')
@@ -254,8 +254,6 @@ class InheritHrPayslip(models.Model):
for rec in self:
if rec.line_ids:
for line in rec.line_ids:
if line.name == '六一儿童节福利':
rec.children_welfare_fee = line.total
if line.name == '儿童节慰问金':
rec.condolence_fund = line.total
if line.name == '春节福利':
@@ -13,8 +13,9 @@ class InheritHrPayslipLine(models.Model):
@api.onchange('total')
def _onchange_total(self):
if self.total and self.amount:
if self.total != self.amount:
self.is_amount = True
else:
self.is_amount = False
for rec in self:
if rec.total:
if rec.total != rec.amount:
rec.is_amount = True
else:
rec.is_amount = False
@@ -91,8 +91,6 @@ class YuthonPayrollCommon(models.Model):
formula_salary = "result = 0"
if ins.name == '上月值班费':
formula_salary = "result = 0"
if ins.name == '六一儿童节福利费':
formula_salary = "result = 0"
if ins.name == '环境作业津贴':
formula_salary = "result = 0"
if ins.name == '儿童节慰问金':
+11 -10
View File
@@ -2,6 +2,7 @@
from odoo import models, fields, api, _, SUPERUSER_ID
from odoo.exceptions import ValidationError, UserError
from odoo.exceptions import ValidationError
import calendar
from pypinyin import pinyin, Style
import math
import xlrd
@@ -33,30 +34,30 @@ class SalaryComputeWizard(models.Model):
def onchange_select_year_select_time(self):
year = int(self.select_year)
month = int(self.select_time)
import calendar
last_day = calendar.monthrange(year, month)[1]
target_date = datetime(year, month, last_day).strftime('%Y-%m-%d')
# 计算当月第一天和最后一天
first_day = datetime(year, month, 1).strftime('%Y-%m-%d')
last_day = datetime(year, month, calendar.monthrange(year, month)[1]).strftime('%Y-%m-%d')
if self.company_id:
employees = self.env['hr.employee'].search([
('company_id', '=', self.company_id.id),
('is_salary', '=', True),
('entry_date', '<=', target_date),
('entry_date', '<=', last_day),
('contract_id', '!=', False),
'|',
('contract_id.termination_date', '>=', target_date),
('contract_id.termination_date', '>=', first_day),
'|',
'&',
('contract_id.termination_date', '=', False),
('contract_id.date_end', '>=', target_date),
('contract_id.date_end', '>=', first_day),
'&',
('contract_id.termination_date', '=', False),
('contract_id.date_end', '=', False)
])
self.employee_ids = [(6, 0, employees.ids)]
self.employee_number = len(self.employee_ids)
for employee_id in self.employee_ids.ids:
employee = self.env['hr.employee'].browse(employee_id)
# 打印员工姓名
self.employee_number = len(employees)
for employee in employees:
print(f"员工姓名: {employee.name}")
@api.onchange('employee_ids')