I'm looking for a way to override the _createStripeToken function of the payment_stripe_sca module in odoo 12.
I am doing it like this but the console.log is not displayed. If I add this console log in the original one it is displayed
PaymentForm.include({
/**
* @override
* @private
* @param {Event} ev
* @param {DOMElement} checkedRadio
* @param {Boolean} addPmEvent
*/
_createStripeToken: function (ev, $checkedRadio, addPmEvent) {
console.log("Adfadsfasdfasdfas")
}
})
You need to patch the payment form class and add the js file to the frontend assets ( web.assets_frontend
).
Override the _createStripeToken
function:
odoo.define('stack_overflow.payment_form', function (require) { "use strict"; var PaymentForm = require('payment.payment_form'); PaymentForm.include({ _createStripeToken: function (ev, $checkedRadio, addPmEvent) { var self = this; console.log("Adfadsfasdfasdfas"); return this._super.apply(this, arguments); }, }); });
Add the file to the front end assets:
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Payment Stripe SCA Assets"> <xpath expr="." position="inside"> <script type="text/javascript" src="/stack_overflow/static/src/js/payment_form.js"></script> </xpath> </template>
Check assets management for details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.