From 535e702ea1e096f41fce382f93df4b7bd4d8ad66 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Thu, 3 Apr 2025 16:14:48 +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
---
yuthon_salary/security/salary_security_rule.xml | 10 ++++++++++
yuthon_salary/wizard/salary_compute_wizard.py | 11 +++++++++++
yuthon_salary/wizard/salary_compute_wizard_views.xml | 1 +
3 files changed, 22 insertions(+)
diff --git a/yuthon_salary/security/salary_security_rule.xml b/yuthon_salary/security/salary_security_rule.xml
index 62c8fc527..d3d4aa568 100644
--- a/yuthon_salary/security/salary_security_rule.xml
+++ b/yuthon_salary/security/salary_security_rule.xml
@@ -20,4 +20,14 @@
[('company_id', 'in', company_ids)]
+
+ 劳务多公司
+
+ [('company_id', 'in', company_ids)]
+
+
+ 退休多公司
+
+ [('company_id', 'in', company_ids)]
+
\ 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 54ab90930..29ad766df 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -14,6 +14,7 @@ class SalaryComputeWizard(models.Model):
_description = '薪资计算弹窗'
employee_ids = fields.Many2many('hr.employee', string='人员', store=True)
+ company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company)
employee_number = fields.Integer(string="人数")
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='年份',
default=lambda self: str(datetime.now().year))
@@ -27,6 +28,16 @@ class SalaryComputeWizard(models.Model):
current_month = datetime.now().month
return str(current_month)
+ @api.onchange('company_id')
+ def onchange_company_id(self):
+ if self.company_id:
+ employees = self.env['hr.employee'].search([
+ ('company_id', '=', self.company_id.id),
+ ('is_salary', '=', True),
+ ('contract_id', '!=', False),
+ ])
+ self.employee_ids = [(6, 0, employees.ids)]
+ self.employee_number = len(self.employee_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 76c83441e..9a8c91f1f 100644
--- a/yuthon_salary/wizard/salary_compute_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_compute_wizard_views.xml
@@ -7,6 +7,7 @@