コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
1547 ビュー

I want to overide the function _onClickPay of the checkout_form.js inside the payment module to add code before the redirection. How can i do that?

(The function is in : addons/payment/static/src/js/checkout_form.js)


アバター
破棄
最善の回答

Hi,

To override the _onClickPay function in the checkout_form.js file of the payment module, you can create a custom module in Odoo and define your custom JavaScript code to replace or extend the existing function. Here's an example:
 odoo.define('custom_payment_module.checkout_form', function (require) {    'use strict';
    var CheckoutForm = require('payment.checkout_form');

    CheckoutForm.include({
        _onClickPay: function (ev) {
            // Add your custom code here before redirection
            // Call the original _onClickPay function
            this._super.apply(this, arguments);
            // Add your custom code here after redirection
        },
    });
    return CheckoutForm;
});


Hope it helps

アバター
破棄
関連投稿 返信 ビュー 活動
3
3月 24
2175
0
4月 24
1452
2
1月 24
1592
1
8月 24
942
0
4月 24
1149