[FIX] pylint/javascript-lint

This commit is contained in:
mreficent 2019-03-11 17:36:40 +01:00 committed by tarteo
parent 7aedeff413
commit f31e4d6004
2 changed files with 54 additions and 55 deletions

View File

@ -1,5 +1,5 @@
///* Copyright 2014 Therp BV (<http://therp.nl>)
// * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
/* Copyright 2014 Therp BV (<http://therp.nl>)
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
odoo.define('attachment_preview', function (require) {
'use strict';
@ -17,9 +17,8 @@ odoo.define('attachment_preview', function(require) {
canPreview: function (extension) {
return $.inArray(
extension,
[
'odt', 'odp', 'ods', 'fodt', 'pdf', 'ott', 'fodp', 'otp',
'fods', 'ots'
['odt', 'odp', 'ods', 'fodt', 'pdf', 'ott', 'fodp', 'otp',
'fods', 'ots',
]) > -1;
},
@ -46,7 +45,7 @@ odoo.define('attachment_preview', function(require) {
Sidebar.include(AttachmentPreviewMixin);
Sidebar.include({
events: _.extend({}, Sidebar.prototype.events, {
'click .o_sidebar_preview_attachment': '_onPreviewAttachment'
'click .o_sidebar_preview_attachment': '_onPreviewAttachment',
}),
previewableAttachments: null,
@ -64,7 +63,7 @@ odoo.define('attachment_preview', function(require) {
event.preventDefault();
var self = this,
$target = $(event.currentTarget),
split_screen = $target.attr('data-target') != 'new',
split_screen = $target.attr('data-target') !== 'new',
attachment_id = parseInt($target.attr('data-id'), 10),
attachment_url = $target.attr('data-url'),
attachment_extension = $target.attr('data-extension'),
@ -76,7 +75,7 @@ odoo.define('attachment_preview', function(require) {
this._rpc({
model: 'ir.attachment',
method: 'get_attachment_extension',
args: [attachment_id]
args: [attachment_id],
}).then(function (extension) {
self.showPreview(attachment_id, attachment_url, extension, null, split_screen);
});
@ -104,8 +103,8 @@ odoo.define('attachment_preview', function(require) {
args: [
_.map(_.keys(attachments), function (id) {
return parseInt(id, 10);
})
]
}),
],
}).then(function (extensions) {
var reviewableAttachments = _.map(_.keys(_.pick(extensions, function (extension, id) {
return self.canPreview(extension);
@ -120,8 +119,8 @@ odoo.define('attachment_preview', function(require) {
attachments[id]['url'],
extensions[id],
id + ' - ' + attachments[id]['title']
)
}
),
};
});
deferred.resolve(reviewableAttachments);
}, function () {
@ -147,7 +146,7 @@ odoo.define('attachment_preview', function(require) {
basic_fields.FieldBinaryFile.include(AttachmentPreviewMixin);
basic_fields.FieldBinaryFile.include({
events: _.extend({}, basic_fields.FieldBinaryFile.prototype.events, {
'click .fa-search': '_onPreview'
'click .fa-search': '_onPreview',
}),
_renderReadonly: function () {
@ -176,8 +175,8 @@ odoo.define('attachment_preview', function(require) {
this.model,
this.recordData.id,
this.name,
this.attrs.filename
]
this.attrs.filename,
],
});
},
@ -194,7 +193,7 @@ odoo.define('attachment_preview', function(require) {
_.str.sprintf(_t('Preview %s'), this.field.string),
false
);
}
},
});
var AttachmentPreviewWidget = Widget.extend({
@ -273,7 +272,7 @@ odoo.define('attachment_preview', function(require) {
},
loadPreview: function () {
if (this.attachments.length == 0) {
if (this.attachments.length === 0) {
this.$iframe.attr('src', 'about:blank');
return;
}
@ -287,7 +286,7 @@ odoo.define('attachment_preview', function(require) {
this.activeIndex = 0;
this.updatePaginator();
this.loadPreview();
}
},
});
FormRenderer.include({
@ -320,14 +319,14 @@ odoo.define('attachment_preview', function(require) {
on_detach_callback: function () {
this.attachmentPreviewWidget.hide();
return this._super.apply(this, arguments);
}
},
});
FormController.include({
custom_events: _.extend({}, FormController.prototype.custom_events, {
onAttachmentPreview: '_onAttachmentPreview',
setPreviewableAttachments: '_setPreviewableAttachments'
setPreviewableAttachments: '_setPreviewableAttachments',
}),
_onAttachmentPreview: function (event) {
@ -338,11 +337,11 @@ odoo.define('attachment_preview', function(require) {
this.renderer.attachmentPreviewWidget.setAttachments(
event.data.attachments
);
}
},
});
return {
AttachmentPreviewMixin: AttachmentPreviewMixin,
AttachmentPreviewWidget: AttachmentPreviewWidget
AttachmentPreviewWidget: AttachmentPreviewWidget,
};
});