diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py
index 05509abd1..6b6584dd5 100644
--- a/yuthon_holiday/models/yuthon_vacation_reports.py
+++ b/yuthon_holiday/models/yuthon_vacation_reports.py
@@ -12,7 +12,10 @@ class YuthonVacationReports(models.Model):
company_id = fields.Many2one(related="employee_id.company_id", string="公司")
leave = fields.Float(string='年假')
working_overtime = fields.Float(string='加班时')
- meal_fee = fields.Integer(string="误餐费")
+ meal_fee = fields.Integer(string="误餐次数")
+ leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细')
+ overtime_ids = fields.One2many('vacation.over.line', 'vacation_id', string='加班明细')
+ meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细')
def button_fixes_approval(self):
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
@@ -37,8 +40,9 @@ class YuthonVacationReports(models.Model):
'res_model': 'soong.workflow.record',
'view_mode': 'tree',
'domain': domain,
- 'context': {'group_by': ['workflow_id']}
- }
+ 'context': {'group_by': ['workflow_id'],
+ 'tree_view_ref':'yuthon_holiday.details_tree_view',
+ }}
return action
def update_vacation(self):
@@ -66,6 +70,55 @@ class YuthonVacationReports(models.Model):
})
+ def log(self):
+ return {
+ "type": "ir.actions.act_window",
+ "res_model": 'yuthon.vacation.reports',
+ "res_id": self.id,
+ "name": "详情",
+ "view_mode": "form",
+ }
+
+
+class VacationLeaveLine(models.Model):
+ _name = 'vacation.leave.line'
+ _description = '年假明细'
+
+ vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
+ update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
+ update_date = fields.Date(string='更新时间')
+ update_lines = fields.Text(string='更新额度')
+
+
+class VacationOverline(models.Model):
+ _name = 'vacation.over.line'
+ _description = '加班明细'
+
+ vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
+ update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
+ update_date = fields.Date(string='更新时间')
+ update_lines = fields.Text(string='更新额度')
+
+
+class VacationMealLine(models.Model):
+ _name = 'vacation.meal.line'
+ _description = '误餐明细'
+
+ vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期报表')
+ update_type= fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
+ update_date = fields.Date(string='更新时间')
+ update_lines = fields.Text(string='更新额度')
+
+
+class DetailsTree(models.Model):
+ _name = 'details.tree'
+ _description = '明细表'
+
+ code = fields.Char()
+ name = fields.Char()
+
+
+
diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv
index 08ace331c..07834f674 100644
--- a/yuthon_holiday/security/ir.model.access.csv
+++ b/yuthon_holiday/security/ir.model.access.csv
@@ -7,3 +7,7 @@ access_yuthon_holiday_setting,yuthon_holiday_setting,model_yuthon_holiday_settin
access_leave_allocation_wizard,leave_allocation_wizard,model_leave_allocation_wizard,base.group_user,1,1,1,1
access_yuthon_leave_wizard,yuthon_leave_wizard,model_yuthon_leave_wizard,base.group_user,1,1,1,1
access_yuthon_vacation_reports,yuthon_vacation_reports,model_yuthon_vacation_reports,base.group_user,1,1,1,1
+access_vacation_leave_line,vacation_leave_line,model_vacation_leave_line,base.group_user,1,1,1,1
+access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group_user,1,1,1,1
+access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1
+access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1
diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
index ed9f2284e..8353e9459 100644
--- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml
+++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml
@@ -12,13 +12,56 @@
+
+
+ yuthon.vacation.reports.form
+ yuthon.vacation.reports
+
+
+
+
- 假期报表
- yuthon.vacation.reports
- tree
+ 假期报表
+ yuthon.vacation.reports
+ tree
更新报表
@@ -27,5 +70,17 @@
code
action = model.update_vacation()
+
+
+
+ details.tree.tree
+ details.tree
+
+
+
+
+
+
+
diff --git a/yuthon_hr_attendance/views/hr_attendance_month_views.xml b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
index 84d47f27c..4a015e592 100644
--- a/yuthon_hr_attendance/views/hr_attendance_month_views.xml
+++ b/yuthon_hr_attendance/views/hr_attendance_month_views.xml
@@ -58,7 +58,9 @@
hr.attendance.month.detail.tree
hr.attendance.month.detail
-
+
@@ -254,7 +256,7 @@
- 出勤统计明细
+ 考勤确认单
hr.attendance.month.detail
tree,form
diff --git a/yuthon_hr_attendance/wizard/hr_attendance_month_wizard.py b/yuthon_hr_attendance/wizard/hr_attendance_month_wizard.py
index aef33b348..1d3441713 100644
--- a/yuthon_hr_attendance/wizard/hr_attendance_month_wizard.py
+++ b/yuthon_hr_attendance/wizard/hr_attendance_month_wizard.py
@@ -121,21 +121,27 @@ class HrAttendanceMonthWizard(models.TransientModel):
all_employee_ids.update(calendar.resource_user_ids.ids)
all_employee_ids = list(all_employee_ids)
hr_employee_obj = self.env['hr.employee'].sudo().search([("user_id", "in", user_obj.ids)])
+ # 白名单
+ resource_user_ids = hr_employee_obj.mapped('resource_calendar_id.resource_user_ids').ids
# 循环所有员工对每个人进行统计
for employee in hr_employee_obj:
- if employee.id not in all_employee_ids:
- # 判断当前是否已经创建了考勤明细
- attendance_month_detail_obj = self._get_attendance_month_detail(employee)
- attendance_month_detail_obj.hr_attendance_month_id = attendance_month_obj.id
- # 判断当前用户是否已经确认签字,签字后不再更新
- if attendance_month_detail_obj.state == 'confirmed' and attendance_month_detail_obj.signature:
- continue
- # 更新用户的考勤明细
- attendance_month_detail_obj.analysis_attendance_month_detail()
- self.get_leave_and_overtime_info(employee.id)
- # 返回action动作
- action = self._hr_attendance_month_detail_action()
- return action
+ if (
+ employee.id not in resource_user_ids and
+ employee.contract.state not in ['draft', 'cancel']
+ ):
+ if employee.id not in all_employee_ids:
+ # 判断当前是否已经创建了考勤明细
+ attendance_month_detail_obj = self._get_attendance_month_detail(employee)
+ attendance_month_detail_obj.hr_attendance_month_id = attendance_month_obj.id
+ # 判断当前用户是否已经确认签字,签字后不再更新
+ if attendance_month_detail_obj.state == 'confirmed' and attendance_month_detail_obj.signature:
+ continue
+ # 更新用户的考勤明细
+ attendance_month_detail_obj.analysis_attendance_month_detail()
+ self.get_leave_and_overtime_info(employee.id)
+ # 返回action动作
+ action = self._hr_attendance_month_detail_action()
+ return action
# 考勤定时任务
def button_attendance_month(self):
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index 8a28c2262..886b50449 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -174,26 +174,20 @@
+
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index 442355e37..fc613c02d 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -128,7 +128,7 @@ class InheritHrPayslip(models.Model):
def action_refresh_from_work_entries(self):
payslip_records = self.browse(self._context.get('active_ids', self._context.get('active_id')))
payslips = payslip_records or self
- # 过滤出状态为草稿或已验证的工资单
+ # 过滤出状态为草稿或已验证的工资单f
payslips = payslips.filtered(
lambda slip: slip.state in ['draft', 'verify']
and not slip.employee_id.contract_id.is_probation
diff --git a/yuthon_salary/models/inherit_hr_payslip_run.py b/yuthon_salary/models/inherit_hr_payslip_run.py
index b42afc067..79ddcc61d 100644
--- a/yuthon_salary/models/inherit_hr_payslip_run.py
+++ b/yuthon_salary/models/inherit_hr_payslip_run.py
@@ -9,6 +9,9 @@ class InheritHrPayslipRun(models.Model):
_inherit = 'hr.payslip.run'
document_ids = fields.Many2many('ir.attachment', string="附件")
+ run_stage = fields.Selection([('payroll_calculations', '薪资计算'), ('individual_tax', '个税计算'), ('finalized', '待审定'),
+ ('to_be_signed', '待签名'), ('to_be_issued', '待发放'), ('issued', '已发放')], default='payroll_calculations',
+ string="阶段")
def Fileline(self):
domain = [('is_salary_push', '=', True), ('is_salary_release', '=', True)]
@@ -24,8 +27,11 @@ class InheritHrPayslipRun(models.Model):
def _onchange_document_ids(self):
for rec in self:
if rec.document_ids:
- rec.state = 'verify'
+ rec.run_stage = 'to_be_issued'
def add_comment(self):
for rec in self:
- rec.state = 'close'
+ rec.run_stage = 'issued'
+
+
+
diff --git a/yuthon_salary/views/inherit_hr_payslip_run_views.xml b/yuthon_salary/views/inherit_hr_payslip_run_views.xml
index 14b1e8e20..a931ef8c9 100644
--- a/yuthon_salary/views/inherit_hr_payslip_run_views.xml
+++ b/yuthon_salary/views/inherit_hr_payslip_run_views.xml
@@ -8,10 +8,14 @@
bottom
+
+ 1
+
+
-
+
diff --git a/yuthon_salary/wizard/put_return_wizard.py b/yuthon_salary/wizard/put_return_wizard.py
index 23f4a14e4..e3a4f2380 100644
--- a/yuthon_salary/wizard/put_return_wizard.py
+++ b/yuthon_salary/wizard/put_return_wizard.py
@@ -11,6 +11,7 @@ class PutWizard(models.TransientModel):
payslip_records = self.env["hr.payslip"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
+ record.payslip_run_id.run_stage = 'individual_tax'
record.write({'is_push': True})
@@ -24,6 +25,7 @@ class ReturnWizard(models.TransientModel):
payslip_records = self.env["hr.payslip"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
+ record.payslip_run_id.run_stage = 'payroll_calculations'
record.write({'is_push': False})
@@ -37,6 +39,7 @@ class PutSalaryWizard(models.TransientModel):
payslip_records = self.env["hr.payslip"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
+ record.payslip_run_id.run_stage = 'finalized'
record.write({'is_salary_push': True, 'is_salary_release': False})
@@ -50,4 +53,5 @@ class ReturnSalaryWizard(models.TransientModel):
payslip_records = self.env["hr.payslip"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
+ record.payslip_run_id.run_stage = 'individual_tax'
record.write({'is_salary_push': False, 'is_salary_release': False})
\ No newline at end of file
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index a4662ddd1..e81a4bde3 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -31,11 +31,15 @@ class SalaryComputeWizard(models.Model):
@api.onchange('company_id')
def onchange_company_id(self):
+ user_obj = self.env['res.users'].sudo().search([])
+ hr_employee_obj = self.env['hr.employee'].sudo().search([("user_id", "in", user_obj.ids)])
+ resource_user_ids = hr_employee_obj.mapped('resource_calendar_id.resource_user_ids').ids
if self.company_id:
employees = self.env['hr.employee'].search([
+ ('id', 'not in', resource_user_ids),
('company_id', '=', self.company_id.id),
('is_salary', '=', True),
- ('contract_id.state', '!=', 'cancel'),
+ ('contract_id.state', 'not in', ['draft', 'cancel']),
('contract_id', '!=', False),
])
self.employee_ids = [(6, 0, employees.ids)]
@@ -48,17 +52,12 @@ class SalaryComputeWizard(models.Model):
self.employee_number = len(self.employee_ids)
def confirm(self):
- attendance_records = self.env['hr.attendance.month'].search([
- ('current_year', '=', self.select_year),
- ('current_month', '=', self.select_time),
- ])
- # if not attendance_records:
- # raise ValidationError(
- # f"在 {self.select_year} 年 {self.select_time} 月没有出勤月度汇总记录,请先完成考勤统计。")
- # if not all(record.is_state for record in attendance_records):
- # raise ValidationError(
- # f"在 {self.select_year} 年 {self.select_time} 月的出勤月度汇总记录未全部确认,请先确认考勤。"
for employee in self.employee_ids:
+ detail_id = self.env['hr.attendance.month.detail'].search([('employee_id', '=', employee.id),
+ ('current_year', '=', self.select_year),
+ ('current_month', '=', self.select_time)])
+ if detail_id.state == 'unconfirmed':
+ raise UserError(f'{employee.name}的{self.select_time}考勤还未确认,请先确认考勤再进行工资计算!')
contract_id = self.env['hr.contract'].search([('employee_id', '=', employee.id)], limit=1)
year = int(self.select_year)
month = int(self.select_time)
diff --git a/yuthon_salary/wizard/salary_compute_wizard_views.xml b/yuthon_salary/wizard/salary_compute_wizard_views.xml
index 3acde7a57..f10084cbf 100644
--- a/yuthon_salary/wizard/salary_compute_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_compute_wizard_views.xml
@@ -7,11 +7,11 @@