[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
This commit is contained in:
app
2016-12-09 11:51:21 +01:00
committed by Martin Trigaux
parent d29c40e1e1
commit d6ead3dbe0
+1 -1
View File
@@ -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])