From 6d30f13d5a3ea271c5f093283c14bb0c719ca1af Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Sat, 22 Mar 2025 18:58:03 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../models/yuthon_hr_employee.py | 2 +-
yuthon_salary/models/inherit_hr_payslip.py | 44 +++++++++++++-
yuthon_salary/security/ir.model.access.csv | 4 +-
.../views/inherit_hr_payslip_views.xml | 60 +++++++++++++++----
yuthon_salary/wizard/put_return_wizard.py | 39 ++++++++++--
.../wizard/put_return_wizard_viwes.xml | 38 ++++++++++++
yuthon_work_brand/views/hr_menus.xml | 1 +
7 files changed, 168 insertions(+), 20 deletions(-)
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index e5d754909..0a3215461 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -43,7 +43,7 @@ class YuthonHrEmployee(models.Model):
# 个人信息
user_salary = fields.Float(string="基本工资")
job_lv_salary = fields.Float(string="职级工资")
- salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组")
+ salary_group_id = fields.Many2one('yuthon.salary.group', string="工资单分组", store=True, index=True)
user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别")
diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index d7eeef769..c0a95afd2 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -7,6 +7,7 @@ class InheritHrPayslip(models.Model):
base_salary = fields.Float(string='基本工资', compute='_compute_salary', store=True)
yuthon_company = fields.Selection([('thtz', '集团本部'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
related='employee_id.yuthon_company', string="所属公司")
+ salary_group_id = fields.Many2one(related='employee_id.salary_group_id', string="工资组", store=True, index=True)
performance_bonuses = fields.Float(string='预发绩效奖金', compute='_compute_salary', store=True)
full_attendance_award = fields.Float(string='全勤奖', compute='_compute_salary', store=True)
commuting_allowance = fields.Float(string='通信补贴', compute='_compute_salary', store=True)
@@ -45,6 +46,7 @@ class InheritHrPayslip(models.Model):
attendance_deduction_total = fields.Float(string='考勤扣款合计')
assessment_reserved_amount = fields.Float(string='考核保留量')
is_push = fields.Boolean(string='推送')
+ is_salary_push = fields.Boolean(string='工资推送')
@api.depends('line_ids')
def _compute_salary(self):
@@ -149,10 +151,50 @@ class InheritHrPayslip(models.Model):
for record in self:
record.write({'is_push': True})
-
def return_button(self):
for record in self:
record.write({'is_push': False})
+ def put_salary_button(self):
+ for record in self:
+ record.write({'is_salary_push': True})
+ def return_salary_button(self):
+ for record in self:
+ record.write({'is_salary_push': False})
+ def action_put_wizard(self):
+ return {
+ "type": "ir.actions.act_window",
+ "name": "推送个税计算",
+ "res_model": "put.wizard",
+ "view_mode": "form",
+ "target": "new",
+ }
+
+ def action_return_wizard(self):
+ return {
+ "type": "ir.actions.act_window",
+ "name": "退回薪资计算",
+ "res_model": "return.wizard",
+ "view_mode": "form",
+ "target": "new",
+ }
+
+ def action_put_salary_wizard(self):
+ return {
+ "type": "ir.actions.act_window",
+ "name": "推送工资确认",
+ "res_model": "put.salary.wizard",
+ "view_mode": "form",
+ "target": "new",
+ }
+
+ def action_return_salary_wizard(self):
+ return {
+ "type": "ir.actions.act_window",
+ "name": "退回个税计算",
+ "res_model": "return.salary.wizard",
+ "view_mode": "form",
+ "target": "new",
+ }
diff --git a/yuthon_salary/security/ir.model.access.csv b/yuthon_salary/security/ir.model.access.csv
index e1c59dfab..13c401bab 100644
--- a/yuthon_salary/security/ir.model.access.csv
+++ b/yuthon_salary/security/ir.model.access.csv
@@ -10,4 +10,6 @@ access_yuthon_account_group,access_yuthon_account_group,model_yuthon_account_gro
access_salary_payslip_wizard,access_salary_payslip_wizard,model_salary_payslip_wizard,base.group_user,1,1,1,1
access_select_delete_wizard,access_select_delete_wizard,model_select_delete_wizard,base.group_user,1,1,1,1
access_put_wizard,access_put_wizard,model_put_wizard,base.group_user,1,1,1,1
-access_return_wizard,access_return_wizard,model_return_wizard,base.group_user,1,1,1,1
\ No newline at end of file
+access_return_wizard,access_return_wizard,model_return_wizard,base.group_user,1,1,1,1
+access_return_salary_wizard, access_return_salary_wizard,model_return_salary_wizard,base.group_user,1,1,1,1
+access_put_salary_wizard,access_put_salary_wizard,model_put_salary_wizard,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_salary/views/inherit_hr_payslip_views.xml b/yuthon_salary/views/inherit_hr_payslip_views.xml
index a3bf8cd2b..e5ca6deed 100644
--- a/yuthon_salary/views/inherit_hr_payslip_views.xml
+++ b/yuthon_salary/views/inherit_hr_payslip_views.xml
@@ -3,11 +3,8 @@
hr.payroll.inherit
hr.payslip
-
+
-
- custom_salary_button
-
1
@@ -38,15 +35,16 @@
-
+
+
@@ -122,6 +120,7 @@
+
@@ -132,7 +131,7 @@
hr.payslip.tree
hr.payslip
-
+
@@ -158,7 +157,7 @@
hr.payslip.tree
hr.payslip
-
+
@@ -171,7 +170,9 @@
+
+
@@ -198,16 +199,24 @@
-
+
+
+ 工资确认
+ hr.payslip
+ tree,form,search
+ [('is_salary_push', '=', True)]
+
+
薪资计算
hr.payslip
- tree,form
+ tree,form,search
[('is_push', '=', False)]
+
@@ -215,12 +224,41 @@
个税计算
hr.payslip
- tree,form
- [('is_push', '=', True)]
+ tree,form,search
+ [('is_push', '=', True), ('is_salary_push', '=', False)]
+
+
+ 批量推送个税计算
+
+
+ code
+ action = model.action_put_wizard()
+
+
+ 批量退回薪资计算
+
+
+ code
+ action = model.action_return_wizard()
+
+
+ 批量推送工资确认
+
+
+ code
+ action = model.action_put_salary_wizard()
+
+
+ 批量退回个税计算
+
+
+ code
+ action = model.action_return_salary_wizard()
+
导入累计专项
diff --git a/yuthon_salary/wizard/put_return_wizard.py b/yuthon_salary/wizard/put_return_wizard.py
index a04472bca..91f93e6f4 100644
--- a/yuthon_salary/wizard/put_return_wizard.py
+++ b/yuthon_salary/wizard/put_return_wizard.py
@@ -11,20 +11,47 @@ class PutWizard(models.TransientModel):
_name = 'put.wizard'
_description = '推送二次确认弹窗'
- name = fields.Char(string='你确定要全部推送吗?', readonly=1)
+ name = fields.Char(string='你确定要推送吗?', readonly=1)
def put_confirm(self):
- payslip_records = self.env['hr.payslip'].search([])
+ payslip_records = self.env["hr.payslip"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
record.write({'is_push': True})
class ReturnWizard(models.TransientModel):
_name = 'return.wizard'
- _description = '推送退回确认弹窗'
+ _description = '退回确认弹窗'
- name = fields.Char(string='你确定要全部退回吗?', readonly=1)
+ name = fields.Char(string='你确定要退回吗?', readonly=1)
def return_confirm(self):
- payslip_records = self.env['hr.payslip'].search([])
+ payslip_records = self.env["hr.payslip"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
for record in payslip_records:
- record.write({'is_push': False})
\ No newline at end of file
+ record.write({'is_push': False})
+
+
+class PutSalaryWizard(models.TransientModel):
+ _name = 'put.salary.wizard'
+ _description = '推送确认弹窗'
+
+ name = fields.Char(string='你确定要退回吗?', readonly=1)
+
+ def put_confirm(self):
+ payslip_records = self.env["hr.payslip"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in payslip_records:
+ record.write({'is_salary_push': True})
+
+class ReturnSalaryWizard(models.TransientModel):
+ _name = 'return.salary.wizard'
+ _description = '退回确认弹窗'
+
+ name = fields.Char(string='你确定要退回吗?', readonly=1)
+
+ def return_confirm(self):
+ payslip_records = self.env["hr.payslip"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in payslip_records:
+ record.write({'is_salary_push': False})
\ No newline at end of file
diff --git a/yuthon_salary/wizard/put_return_wizard_viwes.xml b/yuthon_salary/wizard/put_return_wizard_viwes.xml
index 0d6bb1dd1..d18b3159b 100644
--- a/yuthon_salary/wizard/put_return_wizard_viwes.xml
+++ b/yuthon_salary/wizard/put_return_wizard_viwes.xml
@@ -38,4 +38,42 @@
+
+ 推送弹窗
+ put.salary.wizard
+
+
+
+
+
+ 退回弹窗
+ return.salary.wizard
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_work_brand/views/hr_menus.xml b/yuthon_work_brand/views/hr_menus.xml
index 44faa7862..bf2a4f03c 100644
--- a/yuthon_work_brand/views/hr_menus.xml
+++ b/yuthon_work_brand/views/hr_menus.xml
@@ -61,6 +61,7 @@
sequence="12"/>