跳至内容
菜单
此问题已终结
2629 查看

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


形象
丢弃
相关帖文 回复 查看 活动
0
8月 22
2462
1
7月 22
20161
0
4月 22
3106
3
9月 21
3272
2
9月 21
4602