[FIX] payment: initialize txContext before await
Steps to reproduce: - install website_sale; - install website_sale_picking; - enable just "Pay in store when picking the product" provider; - pusblish just "[On Site Pick] My Shop 1" shipping method; - go to ecommerce and make the purchase flow. Issue: A traceback appears on the "/shop/payment" page. Cause: We use the `txContext` field in the `_setPaymentFlow` method before it is initialized. Indeed during the `start` method, we have to wait for the end of the super before `txContext` is initialized. Since the `start` method is asynchronous, this will not block the `_setPaymentFlow` method call which will use the uninitialized field. opw-3257641 closes odoo/odoo#119351 X-original-commit: 18b629bfc26ab69e5e3bdc8aac090de66cf13f36 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com> Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
* @override
|
||||
*/
|
||||
start: async function () {
|
||||
this.txContext = {}; // Synchronously initialize txContext before any await.
|
||||
Object.assign(this.txContext, this.$el.data());
|
||||
await this._super(...arguments);
|
||||
window.addEventListener('pageshow', function (event) {
|
||||
if (event.persisted) {
|
||||
@@ -38,8 +40,6 @@
|
||||
}
|
||||
});
|
||||
this.$('[data-bs-toggle="tooltip"]').tooltip();
|
||||
this.txContext = {};
|
||||
Object.assign(this.txContext, this.$el.data());
|
||||
const $checkedRadios = this.$('input[name="o_payment_radio"]:checked');
|
||||
if ($checkedRadios.length === 1) {
|
||||
const checkedRadio = $checkedRadios[0];
|
||||
|
||||
Reference in New Issue
Block a user