Skip to Content
Menu
This question has been flagged
2 Replies
2470 Views

Hello, I've been trying to override what the payEvent function does. This function is on the payment_form.js in the payment module payment/static/src/js. Here is the code I'm using:

odoo.define('test_overriding.test', function (require) ) {

"use strict";

var Payment_form = require('payment.payment_form');

Payment_form.include({

                        payEvent: function(ev){

                            console.log("test")

                        }

});

});

The problem is that when I go to the instance of odoo it gives me a Missing dependencies on the payment.payment_form

Any guidance would be helpful, thanks in advance.

Note: I'm using odoo v11

Avatar
Discard
Author Best Answer

Hello Kinjal, thanks for your help, did what you said but it keeps giving the same error, maybe I wasn't clear in what I was trying to accomplish, I created a new module called test_overriding in which I set to load assets.xml on the manifest, in there I have the code you gave me but with the data of this module, then in the same module in static/src/js I have the custom.js file with the code I gave at the beggining. What it seems to happen in my opinion is that I cannot inherit from the payment.payment_form function defined from the payment odoo default module, I'm not sure about this, maybe I'm not doing that correctly or there is another name for it or something? thanks in advance again for all your help

Avatar
Discard
Best Answer

give file path in assets.xml like this

```
<template id="custom_js" inherit_id="web.assets_frontend"> <xpath expr="." position="inside"> <script type="text/javascript" src="/<path>/static/src/js/payment_form.js" /> </xpath> </template>

and write

"odoo.define('test_overriding.test', function (require) {" line instead of " odoo.define('test_overriding.test', function (require) ) {"

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 23
1960
3
Jul 21
4276
1
Aug 19
2272
0
Oct 18
2810
1
May 23
1249