mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-23 04:22:04 -06:00
Merge pull request #50 from hbrunn/8.0-document_choose_directory
[ADD] allow to override attachment sorting
This commit is contained in:
commit
8a2d2775de
@ -52,10 +52,14 @@ openerp.document_choose_directory = function(instance)
|
||||
},
|
||||
on_attachments_loaded: function(attachments)
|
||||
{
|
||||
var attachments_per_directory = [];
|
||||
var self = this,
|
||||
attachments_per_directory = [];
|
||||
_.chain(attachments)
|
||||
.groupBy(
|
||||
function(a) { return a.parent_id[0] })
|
||||
.sortBy(function(attachments) {
|
||||
return attachments[0].parent_id[1];
|
||||
})
|
||||
.each(
|
||||
function(group)
|
||||
{
|
||||
@ -64,7 +68,7 @@ openerp.document_choose_directory = function(instance)
|
||||
instance.web._t('No directory'),
|
||||
classname: 'oe_attachment_directory',
|
||||
});
|
||||
_(group).each(function(a)
|
||||
self.sort_attachments(group).each(function(a)
|
||||
{
|
||||
attachments_per_directory.push(a);
|
||||
});
|
||||
@ -80,5 +84,9 @@ openerp.document_choose_directory = function(instance)
|
||||
return i.classname == 'oe_attachment_directory';
|
||||
});
|
||||
},
|
||||
sort_attachments: function(attachments)
|
||||
{
|
||||
return _.chain(attachments).sortBy('name');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user