From 98d8cae5b00551b5134333f3a799648e1818401a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Thu, 2 Jul 2026 17:06:41 +0800 Subject: [PATCH 1/2] =?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/inherit_hr_payroll_structure.py | 21 +++++++++++++++++++ .../security/salary_security_rule.xml | 5 ----- .../inherit_hr_payroll_structure_views.xml | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/yuthon_salary/models/inherit_hr_payroll_structure.py b/yuthon_salary/models/inherit_hr_payroll_structure.py index 170545dd7..3b4e20fd0 100644 --- a/yuthon_salary/models/inherit_hr_payroll_structure.py +++ b/yuthon_salary/models/inherit_hr_payroll_structure.py @@ -27,6 +27,27 @@ class HrPayrollStructure(models.Model): integrated_subsidy = fields.Monetary(string="综合补贴", currency_field="currency_id") advance_performance_bonuses = fields.Monetary(string="月绩效奖金", currency_field="currency_id") renk_log_ids = fields.One2many("rank.log.line", "structure_id", string="职级日志明细行") + is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company', + search='_search_part_of_company') + + @api.depends_context('uid', 'company') + @api.depends('company_id') + def _compute_is_company(self): + active_company_ids = self.env.companies + for employee in self: + employee.is_company = employee.company_id in active_company_ids + + def _search_part_of_company(self, operator, value): + company_ids = self.env.companies.ids # 获取公司ID列表 + # 处理反向操作符 + if not value: + operator = '!=' if operator == '=' else '=' + # 使用company_id in company_ids的结构 + if operator == '=': + return [('company_id', 'in', company_ids)] + else: # operator == '!=' + return [('company_id', 'not in', company_ids)] + @api.depends('create_time', 'end_time') def _compute_is_enable(self): diff --git a/yuthon_salary/security/salary_security_rule.xml b/yuthon_salary/security/salary_security_rule.xml index 07be11abe..adbc88277 100644 --- a/yuthon_salary/security/salary_security_rule.xml +++ b/yuthon_salary/security/salary_security_rule.xml @@ -45,11 +45,6 @@ [('company_id', 'in', company_ids)] - - 职级多公司 - - [('company_id', 'in', company_ids)] - 劳务多公司 diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index e8068b3d3..8dbdac9a2 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -132,7 +132,7 @@ 职级 hr.payroll.structure tree,form,search - [('is_enable', '=', True)] + [('is_enable', '=', True), ('is_company', '=', True)] From 4fcd878c2aa345dfd4d6fa54b4f6f6b6d3053335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Thu, 2 Jul 2026 17:08:00 +0800 Subject: [PATCH 2/2] =?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/views/inherit_hr_payroll_structure_views.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml index 8dbdac9a2..9f6fb1c36 100644 --- a/yuthon_salary/views/inherit_hr_payroll_structure_views.xml +++ b/yuthon_salary/views/inherit_hr_payroll_structure_views.xml @@ -29,6 +29,7 @@ + @@ -47,6 +48,7 @@ + @@ -139,7 +141,7 @@ 历史职级 hr.payroll.structure tree,form,search - [('is_enable', '=', False)] + [('is_enable', '=', False), ('is_company', '=', True)] {'search_default_group_lv_id': 1}