Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3410 Представления

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

Аватар
Отменить
Автор Лучший ответ

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

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
авг. 23
2952
Override JS mail Решено
3
июл. 21
5231
1
авг. 19
2998
0
окт. 18
3795
1
мая 23
2393