Skip to content

Commit 81bf4c0

Browse files
committed
[FIX] dms_field_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 109f92c commit 81bf4c0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

dms_field_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 (http://www.gnu.org/licenses/agpl).
33
import re
44

@@ -46,9 +46,11 @@ def _compute_record_ref(self):
4646
def _compute_directory_id(self):
4747
"""Overwrite to redefine the directory if the template has a linked model."""
4848
self_with_model = self.filtered(lambda x: x.template_id.model_id)
49-
directory_model = self.env["dms.directory"].sudo()
49+
company = self.parent_id.template_id.company_id or self.env.company
50+
directory_model = self.env["dms.directory"]
5051
for item in self_with_model:
5152
domain = [
53+
("company_id", "=", company.id),
5254
("res_model", "=", item.template_id.model_id.model),
5355
("res_id", ">", 0),
5456
]

0 commit comments

Comments
 (0)