From eed843dcca527a8818c07df1d00a108825aba8a4 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 closes odoo/odoo#159393 X-original-commit: e941363242c918f52222b105de7336e8c830e8db Signed-off-by: Quentin Smetz (qsm) --- addons/website_event_meet/static/src/js/snippets/options.js | 4 +++- addons/website_sale/static/src/js/website_sale.editor.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 798afb1ae18..11c5cb15e8e 100644 --- a/addons/website_event_meet/static/src/js/snippets/options.js +++ b/addons/website_event_meet/static/src/js/snippets/options.js @@ -22,8 +22,10 @@ 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, + // TODO: Remove the request_save in master, it's already done by the + // data-page-options set to true in the template. }).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 88f35a5fa56..df15c536eb8 100644 --- a/addons/website_sale/static/src/js/website_sale.editor.js +++ b/addons/website_sale/static/src/js/website_sale.editor.js @@ -229,6 +229,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({ * @see this.selectClass for params */ changeSequence: function (previewMode, widgetValue, params) { + // TODO this should be awaited this.rpc('/shop/config/product', { product_id: this.productTemplateID, sequence: widgetValue, @@ -433,6 +434,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 this.rpc('/shop/config/product', { product_id: this.productTemplateID, x: x, @@ -654,6 +656,7 @@ options.registry.WebsiteSaleProductPage = options.Class.extend({ * Removes all extra-images from the product. */ clearImages: function () { + // TODO this should be awaited this.rpc(`/shop/product/clear-images`, { model: this.mode, product_product_id: this.productProductID, @@ -757,6 +760,7 @@ options.registry.WebsiteSaleProductAttribute = options.Class.extend({ * @see this.selectClass for params */ setDisplayType: function (previewMode, widgetValue, params) { + // TODO this should be awaited this.rpc('/shop/config/attribute', { attribute_id: this.attributeID, display_type: widgetValue, @@ -819,6 +823,7 @@ options.registry.ReplaceMedia.include({ * */ async setPosition(previewMode, widgetValue, params) { + // TODO this should be awaited this.rpc('/shop/product/resequence-image', { image_res_model: this.recordModel, image_res_id: this.recordId,