跳至內容
選單
此問題已被標幟
1 回覆
1716 瀏覽次數

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
2333
0
4月 24
1611
2
1月 24
1695
1
8月 24
1048
0
4月 24
1245