Skip to Content
Menu
This question has been flagged
1 Reply
11529 Views

Hi,

Im in version 10.

In Project module want to override the javascript function on_card_clicked in project.js, wat i want is to delete the line this.$('.o_project_kanban_boxes a').first().click(); and replace it with this line  "this._super.apply(this, arguments);"

Here 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); } },

How can i override this js function? And is it possible to disconnect this function completely from the file project.js through js inheritence technique ?


Thanks

        

Avatar
Discard
Best Answer

Hi Wiem,

Please try to extend update_kanban and re-write on_card_clicked().

#Extende product update_kanban
odoo.define('module_name.update_kanban', function (require) {
   var update_kanban = require('project.update_kanban');
   var KanbanRecord = require('web_kanban.Record');
    update_kanban.KanbanRecord.include({
    on_card_clicked: function () {  
                    this._super.apply(this, arguments);
         }   });

Avatar
Discard

Hello Sushma,

I applied your code but still not resolve

my code is here

odoo.define('ankit_project.update_kanban', function(require) {

"use strict";

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

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

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

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

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

var KanbanView = require('web_kanban.KanbanView');

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

var update_kanban = require('project.update_kanban');

var QWeb = core.qweb;

var _t = core._t;

console.log('Test-----------',arguments)

update_kanban.KanbanRecord.include({

on_card_clicked: function () {

console.log("before-----------")

this._super.apply(this, arguments);

console.log("after-----------")

},

});

});

I am stuck in this problem.

I got error is Failed modules:

Can you suggest me ?

Best Thanks,

Related Posts Replies Views Activity
0
Nov 20
1394
1
Aug 18
8734
0
Feb 23
935
7
Sep 21
25960
0
Mar 19
1466