تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3399 أدوات العرض

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 23
2943
Override JS mail تم الحل
3
يوليو 21
5225
1
أغسطس 19
2993
0
أكتوبر 18
3776
1
مايو 23
2387