diff --git a/attachment_preview/static/src/js/attachment_preview.js b/attachment_preview/static/src/js/attachment_preview.js
index 20423827..0d6abff9 100644
--- a/attachment_preview/static/src/js/attachment_preview.js
+++ b/attachment_preview/static/src/js/attachment_preview.js
@@ -131,7 +131,7 @@ openerp.attachment_preview = function(instance)
attachment_id,
$target.siblings('a').attr('href'),
attachment_extension,
- _t('Preview'));
+ $target.attr('alt'));
});
return (new instance.web.Model('ir.attachment')).call(
'get_binary_extension',
@@ -173,10 +173,10 @@ openerp.attachment_preview = function(instance)
{
var link = this._super.apply(this, arguments);
link += _.template(
- '
',
+ '
',
{
preview_id: options.id,
- preview_text: _t('Preview'),
+ preview_text: _.str.sprintf(_t('Preview %s'), this.string),
preview_model: options.model,
preview_field: this.id,
preview_filename: this.filename || '',
@@ -218,8 +218,9 @@ openerp.attachment_preview = function(instance)
self.name,
self.view.datarecord.id),
extension,
- self.view.datarecord[self.node.attrs.filename]);
+ _.str.sprintf(_t('Preview %s'), self.field.string));
});
+ $element.attr('title', _.str.sprintf(_t('Preview %s'), self.field.string));
}
else
{
@@ -228,6 +229,10 @@ openerp.attachment_preview = function(instance)
});
});
}
+ else
+ {
+ this.$el.find('.oe-binary-preview').remove();
+ };
},
});
}