From d6ead3dbe0a4a4e8dd8793439b297103ae1c6838 Mon Sep 17 00:00:00 2001 From: app Date: Thu, 17 Nov 2016 12:49:36 +0000 Subject: [PATCH] [FIX] base: show attachments of archives records When testing the access rights, attachments associated with archived/inactive records are inadvertently being hidden due to the default ORM behavior of search. Patch simplified while merging. Closes #14366 --- odoo/addons/base/ir/ir_attachment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/ir/ir_attachment.py b/odoo/addons/base/ir/ir_attachment.py index 8de308df405..d84a18d7f69 100644 --- a/odoo/addons/base/ir/ir_attachment.py +++ b/odoo/addons/base/ir/ir_attachment.py @@ -374,7 +374,7 @@ class IrAttachment(models.Model): continue # filter ids according to what access rules permit target_ids = list(targets) - allowed = self.env[res_model].search([('id', 'in', target_ids)]) + allowed = self.env[res_model].with_context(active_test=False).search([('id', 'in', target_ids)]) for res_id in set(target_ids).difference(allowed.ids): ids.difference_update(targets[res_id])