diff options
| author | Denis Ledoux <dle@openerp.com> | 2013-07-24 15:09:36 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@openerp.com> | 2013-07-24 15:09:36 +0200 |
| commit | a3f57cd43b4f6cd00ce06564f7fde1dbb6598d5f (patch) | |
| tree | 5ba2978c77486712c0deb81cc0590eb017552f14 | |
| parent | 7db84a3a724f394d7db3a5628ef85038184ee765 (diff) | |
[FIX]ir_attachement: if res_id = 0, allow to read if allowed to read model
bzr revid: dle@openerp.com-20130724130936-u1payhg18hcssj0z
| -rw-r--r-- | openerp/addons/base/ir/ir_attachment.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openerp/addons/base/ir/ir_attachment.py b/openerp/addons/base/ir/ir_attachment.py index f00cc3f85ed..704488f6938 100644 --- a/openerp/addons/base/ir/ir_attachment.py +++ b/openerp/addons/base/ir/ir_attachment.py @@ -233,10 +233,10 @@ class ir_attachment(osv.osv): targets = cr.dictfetchall() model_attachments = {} for target_dict in targets: - if not (target_dict['res_id'] and target_dict['res_model']): + if not target_dict['res_model']: continue # model_attachments = { 'model': { 'res_id': [id1,id2] } } - model_attachments.setdefault(target_dict['res_model'],{}).setdefault(target_dict['res_id'],set()).add(target_dict['id']) + model_attachments.setdefault(target_dict['res_model'],{}).setdefault(target_dict['res_id'] or 0, set()).add(target_dict['id']) # To avoid multiple queries for each attachment found, checks are # performed in batch as much as possible. @@ -250,7 +250,7 @@ class ir_attachment(osv.osv): # filter ids according to what access rules permit target_ids = targets.keys() - allowed_ids = self.pool[model].search(cr, uid, [('id', 'in', target_ids)], context=context) + allowed_ids = [0] + self.pool[model].search(cr, uid, [('id', 'in', target_ids)], context=context) disallowed_ids = set(target_ids).difference(allowed_ids) for res_id in disallowed_ids: for attach_id in targets[res_id]: |
