From 6698998ac17254c6728eadaf293bed01b289f2fc Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Tue, 11 Mar 2025 10:11:54 +0800
Subject: [PATCH] =?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 | 1 +
.../models/yuthon_party_setting.py | 9 +++++++-
.../security/ir.model.access.csv | 3 ++-
.../views/yuthon_hr_employee_views.xml | 10 ++++++++
.../views/yuthon_party_setting_views.xml | 14 +++++++++++
yuthon_salary/models/inherit_hr_payslip.py | 17 ++++++++++++++
.../views/inherit_hr_payslip_views.xml | 3 +++
yuthon_salary/wizard/salary_compute_wizard.py | 23 ++++++-------------
.../wizard/salary_compute_wizard_views.xml | 4 ++--
yuthon_work_brand/views/hr_menus.xml | 5 ++++
10 files changed, 69 insertions(+), 20 deletions(-)
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index 5c5ce81a5..203479df6 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -43,6 +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="工资单分组")
user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别")
diff --git a/yuthon_hr_employee/models/yuthon_party_setting.py b/yuthon_hr_employee/models/yuthon_party_setting.py
index 19faadb1d..8aad69cd6 100644
--- a/yuthon_hr_employee/models/yuthon_party_setting.py
+++ b/yuthon_hr_employee/models/yuthon_party_setting.py
@@ -13,4 +13,11 @@ class YuthonPartySetting(models.Model):
economy_type = fields.Char(string='经济类型')
address = fields.Text(string='通讯地址')
contact = fields.Char(string='联系人')
- phone = fields.Char(string='电话')
\ No newline at end of file
+ phone = fields.Char(string='电话')
+
+
+class YuthonSalaryGroup(models.Model):
+ _name = 'yuthon.salary.group'
+ _description = '工资单分组'
+
+ name = fields.Char(string='名称', required=True)
\ No newline at end of file
diff --git a/yuthon_hr_employee/security/ir.model.access.csv b/yuthon_hr_employee/security/ir.model.access.csv
index c8bc23a97..a2d039f06 100644
--- a/yuthon_hr_employee/security/ir.model.access.csv
+++ b/yuthon_hr_employee/security/ir.model.access.csv
@@ -18,4 +18,5 @@ access_hr_job_add_wizard,hr_job_add_wizard,model_hr_job_add_wizard,base.group_us
access_yuthon_party_setting,yuthon_party_setting,model_yuthon_party_setting,base.group_user,1,1,1,1
access_yuthon_medical_rule,yuthon_medical_rule,model_yuthon_medical_rule,base.group_user,1,1,1,1
access_yuthon_medical_manage,yuthon_medical_manage,model_yuthon_medical_manage,base.group_user,1,1,1,1
-access_yuthon_medical_line,yuthon_medical_line,model_yuthon_medical_line,base.group_user,1,1,1,1
\ No newline at end of file
+access_yuthon_medical_line,yuthon_medical_line,model_yuthon_medical_line,base.group_user,1,1,1,1
+access_yuthon_salary_group,yuthon_salary_group,model_yuthon_salary_group,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index 8621a2376..6cda30d06 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -21,6 +21,7 @@
+
@@ -226,6 +227,7 @@
+
@@ -269,6 +271,14 @@
+
+
+
+
+
+
+
+
批量更新员工
diff --git a/yuthon_hr_employee/views/yuthon_party_setting_views.xml b/yuthon_hr_employee/views/yuthon_party_setting_views.xml
index 0a5f0cd56..b7efbe8a9 100644
--- a/yuthon_hr_employee/views/yuthon_party_setting_views.xml
+++ b/yuthon_hr_employee/views/yuthon_party_setting_views.xml
@@ -19,4 +19,18 @@
yuthon.party.setting
tree
+
+ yuthon.salary.group.tree
+ yuthon.salary.group
+
+
+
+
+
+
+
+ 工资单分组
+ yuthon.salary.group
+ tree
+
diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index 93564b9cb..3c68d7da8 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -26,3 +26,20 @@ class InheritHrPayslip(models.Model):
if line.name == '职级工资':
rec.rank_salary = line.amount
+ def put_payslip(self):
+ menu_id = self.env['ir.ui.menu'].search([('name', '=', '工资条'), ('parent_id', '!=', False)])
+ str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=hr.payslip&view_type=list'.format(
+ self.id, menu_id.id, menu_id.action.id)
+ we_id = self.env['hr.employee'].search([('id', '=', self.employee_id)]).wecom_userid
+ self.sudo().env["wecom.apps"].sync_send_message_textcard(category='payslip', user_id=we_id, title="薪资确认",
+ description=self.employee_id.name + '请确认你的薪资:',
+ url=str, btntxt="详细信息")
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': {
+ 'type': 'success',
+ 'message': '确认通知已发送',
+ 'sticky': False,
+ }
+ }
\ 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 3e480174f..ffd3437f9 100644
--- a/yuthon_salary/views/inherit_hr_payslip_views.xml
+++ b/yuthon_salary/views/inherit_hr_payslip_views.xml
@@ -24,6 +24,9 @@
+
+
+
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index b06c3621a..5338c8904 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -12,7 +12,8 @@ class SalaryComputeWizard(models.Model):
_name = 'salary.compute.wizard'
_description = '薪资计算弹窗'
- department_ids = fields.Many2many('hr.department', string="部门")
+ yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
+ string='公司')
employee_ids = fields.Many2many('hr.employee', string='人员', store=True)
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='年份',
default=lambda self: str(datetime.now().year))
@@ -26,21 +27,11 @@ class SalaryComputeWizard(models.Model):
current_month = datetime.now().month
return str(current_month)
- @api.onchange('department_ids')
- def onchange_employee_ids(self):
- def get_department_employees(department_id):
- valid_user_ids = set()
- employee_ids = self.env['hr.employee'].search([('department_id', '=', department_id.id.origin)])
- valid_user_ids.update([user.user_id.id for user in employee_ids if user.user_id])
- child_ids = self.env['hr.department'].search([('parent_id', '=', department_id.id)])
- for child in child_ids:
- valid_user_ids.update(get_department_employees(child))
- return valid_user_ids
- department_user_ids = set()
- for department_id in self.department_ids:
- department_user_ids.update(get_department_employees(department_id))
- self.employee_ids = [(6, 0, list(department_user_ids))]
-
+ @api.onchange('yuthon_company')
+ def onchange_yuthon_company(self):
+ if self.yuthon_company:
+ employees = self.env['hr.employee'].search([('yuthon_company', '=', self.yuthon_company)])
+ self.employee_ids = [(6, 0, employees.ids)]
def confirm(self):
for employee in self.employee_ids:
diff --git a/yuthon_salary/wizard/salary_compute_wizard_views.xml b/yuthon_salary/wizard/salary_compute_wizard_views.xml
index e21d9a09d..b5bf7da4a 100644
--- a/yuthon_salary/wizard/salary_compute_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_compute_wizard_views.xml
@@ -7,8 +7,8 @@