From 5dcee64bd1a97d0ba0edcbedcf70c04debffe53e Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 26 Mar 2024 12:56:00 +0000 Subject: [PATCH] [FIX] website_event_meet, *: properly await edit option before reload *: website_sale This is a follow-up of [1], which missed some occurrence of the same issue that it fixed. E.g. - Add a delay to the "write" of the event model - Go to /event//community - Enter edit mode - Click on the page - Enable the room creation option => The page reloads but nothing seems to have been done... it is actually *being* done: the page reloaded too soon. Note: this commit also marks some other occurrences which are not buggy but might be in the future if not properly changed. To be adapted in the master forward-port. [1]: https://github.com/odoo/odoo/commit/556ae457b02e9c077d09fa9c3f9f1e6c6e26b345 X-original-commit: fcdd6a82bdd09acb886d5869a2dae152a5ff48e6 --- .../website_event_meet/static/src/js/snippets/options.js | 4 ++-- addons/website_sale/static/src/js/website_sale.editor.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/website_event_meet/static/src/js/snippets/options.js b/addons/website_event_meet/static/src/js/snippets/options.js index 798afb1ae1851..149431671a08b 100644 --- a/addons/website_event_meet/static/src/js/snippets/options.js +++ b/addons/website_event_meet/static/src/js/snippets/options.js @@ -22,9 +22,9 @@ options.registry.WebsiteEvent.include({ * @see this.selectClass for parameters */ allowRoomCreation(previewMode, widgetValue, params) { - this.orm.write("event.event", [this.eventId], { + return this.orm.write("event.event", [this.eventId], { meeting_room_allow_creation: widgetValue, - }).then(() => this.trigger_up('request_save', {reload: true, optionSelector: this.data.selector})); + }); }, //-------------------------------------------------------------------------- diff --git a/addons/website_sale/static/src/js/website_sale.editor.js b/addons/website_sale/static/src/js/website_sale.editor.js index 1435e33347db8..7e04d97fef5e4 100644 --- a/addons/website_sale/static/src/js/website_sale.editor.js +++ b/addons/website_sale/static/src/js/website_sale.editor.js @@ -220,7 +220,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({ * @see this.selectClass for params */ changeSequence: function (previewMode, widgetValue, params) { - rpc('/shop/config/product', { + return rpc('/shop/config/product', { product_id: this.productTemplateID, sequence: widgetValue, }).then(() => this._reloadEditable()); @@ -424,6 +424,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({ var $td = $(ev.currentTarget); var x = $td.index() + 1; var y = $td.parent().index() + 1 + // TODO this should be awaited somehow rpc('/shop/config/product', { product_id: this.productTemplateID, x: x, @@ -642,7 +643,7 @@ options.registry.WebsiteSaleProductPage = options.Class.extend({ * Removes all extra-images from the product. */ clearImages: function () { - rpc(`/shop/product/clear-images`, { + return rpc(`/shop/product/clear-images`, { model: this.mode, product_product_id: this.productProductID, product_template_id: this.productTemplateID, @@ -736,7 +737,7 @@ options.registry.WebsiteSaleProductAttribute = options.Class.extend({ * @see this.selectClass for params */ setDisplayType: function (previewMode, widgetValue, params) { - rpc('/shop/config/attribute', { + return rpc('/shop/config/attribute', { attribute_id: this.attributeID, display_type: widgetValue, }).then(() => this.trigger_up('request_save', {reload: true, optionSelector: this.data.selector})); @@ -798,7 +799,7 @@ options.registry.ReplaceMedia.include({ * */ async setPosition(previewMode, widgetValue, params) { - rpc('/shop/product/resequence-image', { + return rpc('/shop/product/resequence-image', { image_res_model: this.recordModel, image_res_id: this.recordId, move: widgetValue,