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 #159316

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
  • Loading branch information
qsm-odoo committed Mar 26, 2024
1 parent 1c321cd commit e941363
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ options.registry.WebsiteEvent.include({
* @see this.selectClass for parameters
*/
allowRoomCreation(previewMode, widgetValue, params) {
this._rpc({
return this._rpc({
model: 'event.event',
method: 'write',
args: [[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
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ options.registry.WebsiteSaleProductsItem = options.Class.extend({
* @see this.selectClass for params
*/
changeSequence: function (previewMode, widgetValue, params) {
// TODO this should be awaited
this._rpc({
route: '/shop/config/product',
params: {
Expand Down Expand Up @@ -638,6 +639,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({
route: '/shop/config/product',
params: {
Expand Down Expand Up @@ -811,6 +813,7 @@ options.registry.WebsiteSaleProductPage = options.Class.extend({
* Removes all extra-images from the product.
*/
clearImages: function () {
// TODO this should be awaited
this._rpc({
route: `/shop/product/clear-images`,
params: {
Expand Down Expand Up @@ -918,6 +921,7 @@ options.registry.WebsiteSaleProductAttribute = options.Class.extend({
* @see this.selectClass for params
*/
setDisplayType: function (previewMode, widgetValue, params) {
// TODO this should be awaited
this._rpc({
route: '/shop/config/attribute',
params: {
Expand Down Expand Up @@ -983,6 +987,7 @@ options.registry.ReplaceMedia.include({
*
*/
async setPosition(previewMode, widgetValue, params) {
// TODO this should be awaited
this._rpc({
route: '/shop/product/resequence-image',
params: {
Expand Down

0 comments on commit e941363

Please sign in to comment.