Skip to Content
Menu
This question has been flagged

Hi, I am working on a payment plugin for odoo 16 with an inline form.

I want to show my form only when my payment method is selected. My problem is that if a user select my payment method the "pay now" button go to the state enable for half a second before i can put it back to a disable state.

So, i am looking for the function that enable the button when selecting a provider


Thank you

Avatar
Discard
Best Answer

Hello Hippolyte Lacour,


Below .js function will trigger initialy when clicked on "Pay Now" Button.

// #=== DOM MANIPULATION ===#


//Code 1 in comment//


After that, it will call the below function.


//Code 2 in Comment//


Hope this helps.

   

If you need any help in customization feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Avatar
Discard

Code 1 :

/**
* Check if the submit button can be enabled and do it if so.
*
* @private
* @param {boolean} unblockUI - Whether the UI should also be unblocked.
* @return {void}
*/
_enableButton(unblockUI = true) {
console.log('\n\n---third----')
Component.env.bus.trigger('enablePaymentButton');
if (unblockUI) {
this.call('ui', 'unblock');
}
},

Code 2:

/**
* @override
*/
async start() {
// Synchronously initialize paymentContext before any await.
this.paymentContext = {};
Object.assign(this.paymentContext, this.el.dataset);

await this._super(...arguments);

// Expand the payment form of the selected payment option if there is only one.
const checkedRadio = document.querySelector('input[name="o_payment_radio"]:checked');
if (checkedRadio) {
await this._expandInlineForm(checkedRadio);
this._enableButton(false);
console.log("\n\n--first---")
} else {
this._setPaymentFlow(); // Initialize the payment flow to let providers overwrite it.
}

this.$('[data-bs-toggle="tooltip"]').tooltip();
},

Related Posts Replies Views Activity
1
Sep 24
1448
0
Jul 24
644
1
Jul 24
585
2
Mar 24
3322
0
Sep 24
627