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

I want to trigger the function when user clicks the my custom notebook tab. I tried to use FormRedner but seem not working and I can't see any log is displayed in the browser console. This is how I tried.

My JS file.

odoo.define('project_task_feasibility_check.feasibilitychecktab', function(require) {
    "use strict";

    var FormRenderer = require('web.FormRenderer');

    var CustomFormRenderer = FormRenderer.extend({
        events: _.extend({}, FormRenderer.prototype.events, {
            'click .feasibility_check': '_onfeasibilityTabClick',
        }),
        _onfeasibilityTabClick: function(ev) {
            console.log("Tab clicked!");
            this._rpc({
                model: 'project.task',
                method: 'action_get_feasibility_result',
                args: [/* args */],
            }).then(function(result) {
                console.log('RPC Call Result:', result);
            });
        },
    });

    return CustomFormRenderer;
});

I added js_class in my notebook tab 

js_class="feasibility_check"




My function is not trigged at all. How can I achieve my requirement?

الصورة الرمزية
إهمال
أفضل إجابة

Hi Jornald,
Did you get any solution for it?

الصورة الرمزية
إهمال
أفضل إجابة

Hi Jornald,

In Odoo 16 you need first check where define assets files.

Based on version odoo 15 and above you need to define assets in manifest like below Example.

so in above case you need to define your file path in 

'web.assets_backend'

assets so working fine.

Thanks.


الصورة الرمزية
إهمال
الكاتب

Actually I did it. I just didn't mention in my question.
This is how I did.
"assets": {
"web.assets_backend": [
"project_task_feasibility_check/static/src/js/feasibility_check_tab.js",
],
},

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 23
1604
1
يونيو 24
3843
2
أغسطس 23
4151
0
مايو 23
2248
1
مايو 25
1932