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 @@