From 22179ca948597a1e4313380caf22befd8da762c3 Mon Sep 17 00:00:00 2001 From: "Anita (anko)" Date: Wed, 31 May 2023 14:24:28 +0000 Subject: [PATCH] [FIX] payment_authorize: fix multiple forms bug Due to default JS limitations, when trying to save payment method on subscription it was automatically taking first form that it could find which was payment form and causing an error since payment form was empty. task-3339230 closes odoo/odoo#127332 X-original-commit: 252320a6154ba06cc4c7f96787a39baf12329804 Signed-off-by: Antoine Vandevenne (anv) --- .../static/src/js/payment_form.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/payment_authorize/static/src/js/payment_form.js b/addons/payment_authorize/static/src/js/payment_form.js index 9998e980e1b..b65b9c8f4e3 100644 --- a/addons/payment_authorize/static/src/js/payment_form.js +++ b/addons/payment_authorize/static/src/js/payment_form.js @@ -21,19 +21,19 @@ _getInlineFormInputs: function (providerId) { if (this.authorizeInfo.payment_method_type === "credit_card") { return { - card: document.getElementById(`o_authorize_card_${providerId}`), - month: document.getElementById(`o_authorize_month_${providerId}`), - year: document.getElementById(`o_authorize_year_${providerId}`), - code: document.getElementById(`o_authorize_code_${providerId}`), + card: this.el.querySelector(`#o_authorize_card_${providerId}`), + month: this.el.querySelector(`#o_authorize_month_${providerId}`), + year: this.el.querySelector(`#o_authorize_year_${providerId}`), + code: this.el.querySelector(`#o_authorize_code_${providerId}`), }; } else { return { - accountName: document.getElementById(`o_authorize_account_name_${providerId}`), - accountNumber: document.getElementById( - `o_authorize_account_number_${providerId}` + accountName: this.el.querySelector(`#o_authorize_account_name_${providerId}`), + accountNumber: this.el.querySelector( + `#o_authorize_account_number_${providerId}` ), - abaNumber: document.getElementById(`o_authorize_aba_number_${providerId}`), - accountType: document.getElementById(`o_authorize_account_type_${providerId}`), + abaNumber: this.el.querySelector(`#o_authorize_aba_number_${providerId}`), + accountType: this.el.querySelector(`#o_authorize_account_type_${providerId}`), }; } },