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