From b0695c2b1e4cc0b07da99de5471f2cbbf912e309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 3 Apr 2025 08:10:09 +0800 Subject: [PATCH] 1 --- .../models/inherit_hr_payroll_structure.py | 13 +++++++++++++ yuthon_salary/security/salary_security_rule.xml | 5 +++++ .../views/inherit_hr_payroll_structure_views.xml | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index 3fbeea386..c152f690f 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -7,6 +7,19 @@ class HrPayrollStructure(models.Model): _inherit = 'hr.payroll.structure' _order = 'sequence asc' + def change_company_id(self): + structure_ids = self.browse(self._context.get('active_ids', self._context.get('active_id'))) + for i in structure_ids: + company_id = False + if i.sequence[0] == '1': + company_id = self.env['res.company'].search([('name', '=', '集团本部')]) + if i.sequence[0] == '2': + company_id = self.env['res.company'].search([('name', '=', '天河物管')]) + if i.sequence[0] == '3': + company_id = self.env['res.company'].search([('name', '=', '天河粮储')]) + if company_id: + i.write({'company_id': company_id}) + company_id = fields.Many2one('res.company', string="公司") type_id = fields.Many2one('hr.payroll.structure.type', string="职级类型") level_id = fields.Many2one('yuthon.payroll.type.setting', string="级别") diff --git a/yuthon_salary/security/salary_security_rule.xml b/yuthon_salary/security/salary_security_rule.xml index 84be3a394..62c8fc527 100644 --- a/yuthon_salary/security/salary_security_rule.xml +++ b/yuthon_salary/security/salary_security_rule.xml @@ -15,4 +15,9 @@ [('company_id', 'in', company_ids)] + + 职级多公司 + + [('company_id', 'in', company_ids)] + \ No newline at end of file diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index f28e4782a..750b3171a 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -19,7 +19,6 @@