Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPT-127 Make list of attachments accessible again #22

Open
wants to merge 1 commit into
base: jobrad-14.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions odoo/addons/base/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,14 @@ def _search(self, args, offset=0, limit=None, order=None, count=False, access_ri
args.insert(0, ('res_field', '=', False))

ids = super(IrAttachment, self)._search(args, offset=offset, limit=limit, order=order,
count=False, access_rights_uid=access_rights_uid)
count=count, access_rights_uid=access_rights_uid)

if self.env.is_superuser():
if count or self.env.is_superuser():
# rules do not apply for the superuser
return len(ids) if count else ids
return ids

if not ids:
return 0 if count else []
return []

# Work with a set, as list.remove() is prohibitive for large lists of documents
# (takes 20+ seconds on a db with 100k docs during search_count()!)
Expand Down Expand Up @@ -552,7 +552,7 @@ def _search(self, args, offset=0, limit=None, order=None, count=False, access_ri
limit=limit, order=order, count=count,
access_rights_uid=access_rights_uid)[:limit - len(result)])

return len(result) if count else list(result)
return list(result)

def _read(self, fields):
self.check('read')
Expand Down