Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
12172 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer

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,

Gerelateerde posts Antwoorden Weergaven Activiteit
0
nov. 20
1842
1
aug. 18
9269
0
feb. 23
1395
7
sep. 21
27494
0
mrt. 19
1878