diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2016-03-24 11:09:02 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2016-03-24 11:09:02 +0100 |
| commit | 64e8d9c9727caebdb33b8b0f1d9ded05abcca934 (patch) | |
| tree | 0027d9453c267e25519059873b678a807d9e1252 | |
| parent | 4fdd741b3b843d95baff68f80ace299a1af3ce97 (diff) | |
[FIX] web: clear filename if image error
When the user chooses as product image a file which is not an image, the
message "Could not display the selected image" is displayed. However, at
saving, a traceback is thrown since the file chosen is uploaded anyway.
If the image cannot be displayed, the image field is cleared.
opw-672206
| -rw-r--r-- | addons/web/static/src/js/views/form_widgets.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 92782b5923a..7f5e6c54da4 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -1362,6 +1362,7 @@ var FieldBinaryImage = FieldBinary.extend({ $img.css("max-height", "" + self.options.size[1] + "px"); }); $img.on('error', function() { + self.on_clear(); $img.attr('src', self.placeholder); self.do_warn(_t("Image"), _t("Could not display the selected image.")); }); |
