Skip to content

Commit

Permalink
[FIX] website_event_meet, *: properly await edit option before reload
Browse files Browse the repository at this point in the history
*: 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/<event_id>/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]: 556ae45

closes #159478

X-original-commit: eed843d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
  • Loading branch information
qsm-odoo committed Mar 27, 2024
1 parent d5478e9 commit fcdd6a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/website_event_meet/static/src/js/snippets/options.js
Expand Up @@ -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}));
},

Expand Down
5 changes: 5 additions & 0 deletions addons/website_sale/static/src/js/website_sale.editor.js
Expand Up @@ -220,6 +220,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({
* @see this.selectClass for params
*/
changeSequence: function (previewMode, widgetValue, params) {
// TODO this should be awaited
rpc('/shop/config/product', {
product_id: this.productTemplateID,
sequence: widgetValue,
Expand Down Expand Up @@ -424,6 +425,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,
Expand Down Expand Up @@ -644,6 +646,7 @@ options.registry.WebsiteSaleProductPage = options.Class.extend({
* Removes all extra-images from the product.
*/
clearImages: function () {
// TODO this should be awaited
rpc(`/shop/product/clear-images`, {
model: this.mode,
product_product_id: this.productProductID,
Expand Down Expand Up @@ -742,6 +745,7 @@ options.registry.WebsiteSaleProductAttribute = options.Class.extend({
* @see this.selectClass for params
*/
setDisplayType: function (previewMode, widgetValue, params) {
// TODO this should be awaited
rpc('/shop/config/attribute', {
attribute_id: this.attributeID,
display_type: widgetValue,
Expand Down Expand Up @@ -804,6 +808,7 @@ options.registry.ReplaceMedia.include({
*
*/
async setPosition(previewMode, widgetValue, params) {
// TODO this should be awaited
rpc('/shop/product/resequence-image', {
image_res_model: this.recordModel,
image_res_id: this.recordId,
Expand Down

0 comments on commit fcdd6a8

Please sign in to comment.