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])]