[FIX] document : keep order during the search of ir.attachment

Backport of 16fa24d52258245af4ee9100666bae6ebe664046
This commit is contained in:
Jérome Maes 2015-01-07 12:01:54 +01:00 committed by Martin Trigaux
parent d79a1622bb
commit f89c4cd78d
1 changed files with 3 additions and 0 deletions

View File

@ -104,10 +104,13 @@ class document_file(osv.osv):
visible_parent_ids = self.pool.get('document.directory').search(cr, uid, [('id', 'in', list(parent_ids))])
# null parents means allowed
orig_ids = ids # save the ids, to keep order
ids = parents.get(None,[])
for parent_id in visible_parent_ids:
ids.extend(parents[parent_id])
# sort result according to the original sort ordering
ids = [id for id in orig_ids if id in ids]
return len(ids) if count else ids
def copy(self, cr, uid, id, default=None, context=None):