コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2622 ビュー

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
2446
1
7月 22
20158
0
4月 22
3099
3
9月 21
3265
2
9月 21
4597