From 99159533424fd228cff065beb34b7fdcc0655946 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 22 Jul 2022 11:59:50 +0000 Subject: [PATCH] [FIX] account_tour: ensure the form is saved by the end of the tour Since 54ea9564905f6c140b4892357657e763d21b4fa5 the form view has an "urgent save" fallback mechanism. Even if nothing has changed since the last (?), it will save during unload, which leads to extra requests during the browser teardown (deletion of cookies and storage, navigation to about:blank, ...), which can lead to inconsistent behaviors and non-deterministic errors. - add check steps at the end of the tour to wait for relevant terminal states - perform an explicit save during the tour (before confirmation) Ideally we'd really only block on *dirty* forms, because logically the urgent auto save thing should not trigger if the form is not dirty. However I'm not sure there's any way to check for that externally, so saved it is... Part-of: odoo/odoo#96517 --- addons/account/static/src/js/tours/account.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/account/static/src/js/tours/account.js b/addons/account/static/src/js/tours/account.js index 39cd18a4950..4cbe7d260f9 100644 --- a/addons/account/static/src/js/tours/account.js +++ b/addons/account/static/src/js/tours/account.js @@ -82,12 +82,11 @@ tour.register('account_tour', { content: _t("Set a price"), position: "bottom", run: 'text 100', - }, { + }, + ...tour.stepUtils.saveForm(), + { trigger: "button[name=action_post]", - // FIXME WOWL: this selector needs to work in both legacy and non-legacy views - // because account_invoice_extracts *adds* a js_class on the base view which forces - // the use of a legacy view in enterprise only - extra_trigger: "[name=move_type] [raw-value=out_invoice], [name=move_type][raw-value=out_invoice]", + extra_trigger: "button.o_form_button_edit", content: _t("Once your invoice is ready, press CONFIRM."), }, { trigger: "button[name=action_invoice_sent]", @@ -121,6 +120,14 @@ tour.register('account_tour', { extra_trigger: "[name=move_type] [raw-value=out_invoice], [name=move_type][raw-value=out_invoice]", content: _t("Let's send the invoice."), position: "top" + }, { + trigger: "button[name=action_invoice_sent].btn-secondary", + content: _t("The invoice having been sent, the button has changed priority."), + run() {}, + }, { + trigger: "button[name=action_register_payment]", + content: _t("The next step is payment registration."), + run() {}, } ]);