Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2607 Переглядів

In project/static/src/project.js i want to replace the line "this.$('.o_project_kanban_boxes a').first().click();" by this one          "this._super.apply(this, arguments);"

This is the original function :


on_card_clicked: function () {

       if (this.model === 'project.project') {

         this.$('.o_project_kanban_boxes a').first().click();

       } else {

           this._super.apply(this, arguments);

        }

    },


so with xpath i proceede like this to include a new js file : 

<odoo>

    <data>

       <template id="assets_backend" name="custom assets" inherit_id="web.assets_backend">

            <xpath expr="." position="inside">

                <script type="text/javascript" src="/invoicefr_project/static/src/js/custom_project.js"/>

            </xpath>

        </template>

    </data>

</odoo>


in my new custom_project.js file i did :

odoo.define('invoicefr_project.custom_project', function (require) {

'use strict';



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

var KanbanRecord = require('web_kanban.Record');



var QWeb = core.qweb;

var _t = core._t;



KanbanRecord.include({

on_card_clicked: function () {

       if (this.model === 'project.project') {

         //this.$('.o_project_kanban_boxes a').first().click();

         this._super.apply(this, arguments);

       } else {

           this._super.apply(this, arguments);

        }

    },

    

    });


alert('Hello')


});

but this actually does not work as i expect and does not show me errors also.

Please tell me how to proceed . And if there is a way so that i can make the original function invisible (because when i commented the whole original function in the default code of odoo it worked as i want but i want it to work via js inheritance technique so that i keep the original code untouched)

Thanks


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
серп. 22
2435
1
лип. 22
20157
0
квіт. 22
3098
3
вер. 21
3263
2
вер. 21
4596