mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-21 19:47:24 -06:00
[ADD] allow to override attachment sorting
This commit is contained in:
parent
34fd9b66f5
commit
f09f877f3e
@ -52,7 +52,8 @@ openerp.document_choose_directory = function(instance)
|
|||||||
},
|
},
|
||||||
on_attachments_loaded: function(attachments)
|
on_attachments_loaded: function(attachments)
|
||||||
{
|
{
|
||||||
var attachments_per_directory = [];
|
var self = this,
|
||||||
|
attachments_per_directory = [];
|
||||||
_.chain(attachments)
|
_.chain(attachments)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
function(a) { return a.parent_id[0] })
|
function(a) { return a.parent_id[0] })
|
||||||
@ -64,7 +65,7 @@ openerp.document_choose_directory = function(instance)
|
|||||||
instance.web._t('No directory'),
|
instance.web._t('No directory'),
|
||||||
classname: 'oe_attachment_directory',
|
classname: 'oe_attachment_directory',
|
||||||
});
|
});
|
||||||
_(group).each(function(a)
|
self.sort_attachments(group).each(function(a)
|
||||||
{
|
{
|
||||||
attachments_per_directory.push(a);
|
attachments_per_directory.push(a);
|
||||||
});
|
});
|
||||||
@ -80,5 +81,9 @@ openerp.document_choose_directory = function(instance)
|
|||||||
return i.classname == 'oe_attachment_directory';
|
return i.classname == 'oe_attachment_directory';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
sort_attachments: function(attachments)
|
||||||
|
{
|
||||||
|
return _.chain(attachments).sortBy('name');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user