summaryrefslogtreecommitdiff
path: root/addons/web_unsplash/static/src/js/unsplash_image_widget.js
diff options
context:
space:
mode:
authorSamuel Degueldre <sad@odoo.com>2020-02-17 12:49:28 +0000
committerSamuel Degueldre <sad@odoo.com>2020-03-04 14:31:06 +0000
commit4e14151465f731c4b2b51efd7bb0c1f0466b0c71 (patch)
tree737d7ae12350b32ecbbdeb7f2d661681556ef73a /addons/web_unsplash/static/src/js/unsplash_image_widget.js
parent67868583ac282a538b7029e1e646b2d6813856dd (diff)
[FIX] web_editor: stop media-dialog from loading all db attachments
Before this commit, the media-dialog was reading all attachments that matched certain criteria for each tab. On large databases, this results in the search_read call timing out, preventing the media-dialog from opening and making all images and documents un-editable. One unfortunate consequence of this is that we can no longer use the firstFilter and lastFilter features, as those rely on fetching all records and sorting them client-side, as such, this feature has been removed entirely. task-2198527 closes https://github.com/odoo/odoo/issues/43113 closes odoo/odoo#46895 X-original-commit: 1e91a89b78ff6019c6120c73ea1eab09b3d58d2f Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_unsplash/static/src/js/unsplash_image_widget.js')
-rw-r--r--addons/web_unsplash/static/src/js/unsplash_image_widget.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web_unsplash/static/src/js/unsplash_image_widget.js b/addons/web_unsplash/static/src/js/unsplash_image_widget.js
index 8fb78e7ccb6..86d299c46a6 100644
--- a/addons/web_unsplash/static/src/js/unsplash_image_widget.js
+++ b/addons/web_unsplash/static/src/js/unsplash_image_widget.js
@@ -146,7 +146,11 @@ widgetsMedia.ImageWidget.include({
* @private
*/
_loadMoreImages: function (forceSearch) {
- this._super(this._unsplash.isActive || forceSearch);
+ if (!this._unsplash.isActive) {
+ return this._super(forceSearch);
+ }
+ this.numberOfAttachmentsToDisplay += 10;
+ this.search(this.$('.o_we_search').val() || '');
},
/**
* @override