From 7cdcd9312337e7931bb5785fbced52c19f781834 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: Wed, 21 Jan 2026 14:30:48 +0800 Subject: [PATCH] =?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_official/models/yuthon_file_processing.py | 16 ++++++++++++---- yuthon_official/models/yuthon_sub_enterprises.py | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/yuthon_official/models/yuthon_file_processing.py b/yuthon_official/models/yuthon_file_processing.py index c1411e0da..5beca599c 100644 --- a/yuthon_official/models/yuthon_file_processing.py +++ b/yuthon_official/models/yuthon_file_processing.py @@ -108,17 +108,25 @@ class YuthonFileProcessing(models.Model): for processing in processing_ids: processing._compute_workflow() - @api.depends_context('uid') @api.depends('users_ids') def _compute_is_display(self): - current_user = self.env.user # + current_user = self.env.user + is_system_admin = current_user.has_group('base.group_system') or current_user.has_group('base.group_admin') + current_user = self.env.user for record in self: record._compute_workflow() - record.is_display = current_user in record.users_ids + if is_system_admin: + record.is_display = True + else: + record.is_display = current_user in record.users_ids def _search_part_of_company(self, operator, value): - current_user_id = self.env.uid + current_user = self.env.user + is_system_admin = current_user.has_group('base.group_system') or current_user.has_group('base.group_admin') + current_user_id = current_user.id + if is_system_admin: + return [] if value: if operator == "=": return [("users_ids", "in", [current_user_id])] diff --git a/yuthon_official/models/yuthon_sub_enterprises.py b/yuthon_official/models/yuthon_sub_enterprises.py index 4a6f3a970..7aa8c3f45 100644 --- a/yuthon_official/models/yuthon_sub_enterprises.py +++ b/yuthon_official/models/yuthon_sub_enterprises.py @@ -57,13 +57,22 @@ class YuthonSubEnterprises(models.Model): @api.depends_context('uid') @api.depends('users_ids') def _compute_is_display(self): - current_user = self.env.user # + current_user = self.env.user + is_system_admin = current_user.has_group('base.group_system') or current_user.has_group('base.group_admin') + current_user = self.env.user for record in self: record._compute_workflow() - record.is_display = current_user in record.users_ids + if is_system_admin: + record.is_display = True + else: + record.is_display = current_user in record.users_ids def _search_part_of_company(self, operator, value): - current_user_id = self.env.uid + current_user = self.env.user + is_system_admin = current_user.has_group('base.group_system') or current_user.has_group('base.group_admin') + current_user_id = current_user.id + if is_system_admin: + return [] if value: if operator == "=": return [("users_ids", "in", [current_user_id])]