[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/<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]: https://github.com/odoo/odoo/commit/556ae457b02e9c077d09fa9c3f9f1e6c6e26b345

closes odoo/odoo#159393

X-original-commit: e941363242c918f52222b105de7336e8c830e8db
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2024-03-27 12:34:07 +00:00
parent e900b3868c
commit eed843dcca
2 changed files with 8 additions and 1 deletions
@@ -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}));
},
@@ -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,