|
@ -7,7 +7,6 @@ odoo.define('web_widget_image_url.FieldImageURL', function (require) { |
|
|
var AbstractField = require('web.AbstractField'); |
|
|
var AbstractField = require('web.AbstractField'); |
|
|
var core = require('web.core'); |
|
|
var core = require('web.core'); |
|
|
var registry = require('web.field_registry'); |
|
|
var registry = require('web.field_registry'); |
|
|
var QWeb = core.qweb; |
|
|
|
|
|
var _t = core._t; |
|
|
var _t = core._t; |
|
|
|
|
|
|
|
|
var UrlImage = AbstractField.extend({ |
|
|
var UrlImage = AbstractField.extend({ |
|
@ -16,20 +15,21 @@ odoo.define('web_widget_image_url.FieldImageURL', function (require) { |
|
|
placeholder: "/web/static/src/img/placeholder.png", |
|
|
placeholder: "/web/static/src/img/placeholder.png", |
|
|
supportedFieldTypes: ['char'], |
|
|
supportedFieldTypes: ['char'], |
|
|
|
|
|
|
|
|
url(){ |
|
|
|
|
|
|
|
|
url: function () { |
|
|
return this.value ? this.value : this.placeholder; |
|
|
return this.value ? this.value : this.placeholder; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
_render() { |
|
|
|
|
|
|
|
|
_render: function () { |
|
|
this._super(arguments); |
|
|
this._super(arguments); |
|
|
|
|
|
|
|
|
var self = this; |
|
|
var self = this; |
|
|
var $img = this.$("img:first"); |
|
|
var $img = this.$("img:first"); |
|
|
$img.on('error', function () { |
|
|
$img.on('error', function () { |
|
|
$img.attr('src', self.placeholder); |
|
|
$img.attr('src', self.placeholder); |
|
|
self.do_warn(_t("Image"), _t("Could not display the selected image.")); |
|
|
|
|
|
|
|
|
self.do_warn( |
|
|
|
|
|
_t("Image"), _t("Could not display the selected image.")); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
registry.add('image_url', UrlImage); |
|
|
registry.add('image_url', UrlImage); |
|
|