[FIX] web_editor: image modal nochange close on save
When you open the image modal of the website editor the selected image is the current image. But if the image is not an attachment with an `url` field set (eg. it has been uploaded and is not a file in a /static/ folder) the match between image modal and current did not work and to close it we need to: - actively select the current image then click "Save" - use the X button to close the modal without saving With this changeset, the match of current image with image list is done on the attachment `url` and if unavailable with /web/image/ID/name.jpg path which cover both possibilities. opw-2004073 closes #33799 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -255,7 +255,7 @@ var ImageWidget = MediaWidget.extend({
|
||||
o.id = +o.url.match(/\/web\/content\/(\d+)/, '')[1];
|
||||
}
|
||||
if (o.url) {
|
||||
self._toggleImage(_.find(self.records, function (record) { return record.url === o.url;}) || o, true);
|
||||
self._toggleImage(_.find(self.records, function (record) { return record.src === o.url;}) || o, true);
|
||||
}
|
||||
|
||||
return def;
|
||||
|
||||
Reference in New Issue
Block a user