Skip to content

Commit 64d799f

Browse files
committed
[FIX] dms_auto_classification: Filter by the appropriate directories
It is important not to apply sudo() to filter by the directories to which the user has access and to filter only by those of the appropriate company. TT60719
1 parent 2627127 commit 64d799f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

dms_auto_classification/wizards/wizard_dms_classification.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Tecnativa - Víctor Martínez
1+
# Copyright 2024-2026 Tecnativa - Víctor Martínez
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33
import base64
44
import re
@@ -175,7 +175,9 @@ def _compute_file_name(self):
175175

176176
@api.depends("file_name")
177177
def _compute_directory_id(self):
178-
directories = self.env["dms.directory"].sudo().search([])
178+
company = self.parent_id.template_id.company_id or self.env.company
179+
domain = [("company_id", "=", company.id)]
180+
directories = self.env["dms.directory"].search(domain)
179181
for item in self:
180182
item.directory_id = self.parent_id._get_directory_from_pattern(
181183
self.parent_id.template_id.directory_pattern, directories

0 commit comments

Comments
 (0)