summaryrefslogtreecommitdiff
path: root/addons/document/static
diff options
context:
space:
mode:
Diffstat (limited to 'addons/document/static')
-rw-r--r--addons/document/static/src/js/document.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js
index 2dde2696c81..e4bce2da76e 100644
--- a/addons/document/static/src/js/document.js
+++ b/addons/document/static/src/js/document.js
@@ -5,6 +5,19 @@ openerp.document = function (instance) {
this._super.apply(this, arguments);
this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), });
this.items['files'] = [];
- }
+ },
+ on_attachments_loaded: function(attachments) {
+ //to display number in name if more then one attachment which has same name.
+ var self = this;
+ _.chain(attachments)
+ .groupBy(function(attachment) { return attachment.name})
+ .each(function(attachment){
+ if(attachment.length > 1)
+ _.map(attachment, function(attachment, i){
+ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)
+ })
+ })
+ self._super(attachments);
+ },
});
-}; \ No newline at end of file
+};