Merge lp:~openerp-dev/openobject-server/6.0-opw-575137-cpa into lp:openobject-server/6.0

Proposed by Chirag Patel (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-575137-cpa
Merge into: lp:openobject-server/6.0
Diff against target: 28 lines (+9/-2)
1 file modified
bin/addons/base/ir/ir_attachment.py (+9/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-575137-cpa
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+108140@code.launchpad.net

Description of the change

Hello,

Fixed ir attachment not return all ids when search.

Demo:

1) Project task named *Task A* which contains 13 files attached (named *Document 001 a.txt to Document 013 a.txt*)
2) Project task named *Task B* which contains also 13 files (named *Document 001 b.txt to Document 013 b.txt*)
3) Under the Knowledge/Documents section, those 26 files are displayed correctly, even if I sort the list by name or changing the limit to 20 records per page, or anyother option.
4) Delete the *Task A* from Project/Tasks, without deleting the attached files. Those files remains binary into the database, but they are hidden.
5) Go to Knowledge/Documents and check the files displayed there. There are 13 files, those which are attached to the remaining task named *Task B*.
6) Sort the documents list by name and change the limit to 20 records per page. Now, the list displays only 10 documents.

video link: http://blip.tv/emylmatei/knowledge-documents-list-display-wrong-number-of-records-per-page-scenario-6160548

Thanks.

To post a comment you must log in.
3622. By Chirag Patel (OpenERP)

[FIX] Fixed attachment not display at sidebar.

Unmerged revisions

3622. By Chirag Patel (OpenERP)

[FIX] Fixed attachment not display at sidebar.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/ir/ir_attachment.py'
2--- bin/addons/base/ir/ir_attachment.py 2011-05-02 11:57:10 +0000
3+++ bin/addons/base/ir/ir_attachment.py 2012-06-08 10:44:19 +0000
4@@ -57,8 +57,8 @@
5
6 def search(self, cr, uid, args, offset=0, limit=None, order=None,
7 context=None, count=False):
8- ids = super(ir_attachment, self).search(cr, uid, args, offset=offset,
9- limit=limit, order=order,
10+ ids = super(ir_attachment, self).search(cr, uid, args, offset=0,
11+ limit=0, order=order,
12 context=context, count=False)
13 if not ids:
14 if count:
15@@ -95,6 +95,13 @@
16 ids.remove(attach_id)
17 if count:
18 return len(ids)
19+
20+ if limit == 0:
21+ limit = None
22+
23+ ids = ids[offset:]
24+ ids = ids[:limit]
25+
26 return ids
27
28 def read(self, cr, uid, ids, fields_to_read=None, context=None, load='_classic_read'):