Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3423 Widoki

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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) ) {"

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sie 23
2956
Override JS mail Rozwiązane
3
lip 21
5238
1
sie 19
3002
0
paź 18
3805
1
maj 23
2394