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..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 @@
+
@@ -132,14 +134,14 @@
职级
hr.payroll.structure
tree,form,search
- [('is_enable', '=', True)]
+ [('is_enable', '=', True), ('is_company', '=', True)]
历史职级
hr.payroll.structure
tree,form,search
- [('is_enable', '=', False)]
+ [('is_enable', '=', False), ('is_company', '=', True)]
{'search_default_group_lv_id': 1}