From ba1f4dc381dc412cfbed84831bedd1af704d2ff2 Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Fri, 26 Jul 2019 13:43:17 +0000 Subject: [PATCH] [FIX] web: fix error when image field can't load image when image field cannot load an image, it will default to the placeholder image. If this placeholder image also cannot be loaded it was creating an infinite loop errors After this commit, we only show one error if the original image cannot be downloaded and if the placeholder cannot be downloaded, we don't show anything else. closes odoo/odoo#35226 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/fields/basic_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index bf1b1139998..b3bf09ab88d 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1586,8 +1586,8 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ } this.$('> img').remove(); this.$el.prepend($img); + $img.one('error', function () { - self._clearFile(); $img.attr('src', self.placeholder); self.do_warn(_t("Image"), _t("Could not display the selected image.")); });