Overriding odoo 11 javascript private method
up vote
0
down vote
favorite
I have a situation where I need to take a specific action when a row is clicked in a tree view for a given model. The problem is with the rewriting of the Odoo JS framework in V11, the method I am interested in is declared private. Here the method I want to override from the list_renderer.js
file.
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
// The special_click property explicitely allow events to bubble all
// the way up to bootstrap's level rather than being stopped earlier.
if (!$(event.target).prop('special_click')) {
var id = $(event.currentTarget).data('id');
if (id) {
this.trigger_up('open_record', {id:id, target: event.target});
}
}
},
What I want to achieve is:
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
//The condition may be something else
if (this.model=='my_module.my_model'){
// Do a specific action here
}
else{
this._super(event);
}
},
I have tried following, but the console.log('Test')
output is never displayed
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_onRowClicked: function (event) {
console.log('Test');
},
})
Any idea on how I can achieve this?
Thanks in advance!!
javascript odoo-11
add a comment |
up vote
0
down vote
favorite
I have a situation where I need to take a specific action when a row is clicked in a tree view for a given model. The problem is with the rewriting of the Odoo JS framework in V11, the method I am interested in is declared private. Here the method I want to override from the list_renderer.js
file.
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
// The special_click property explicitely allow events to bubble all
// the way up to bootstrap's level rather than being stopped earlier.
if (!$(event.target).prop('special_click')) {
var id = $(event.currentTarget).data('id');
if (id) {
this.trigger_up('open_record', {id:id, target: event.target});
}
}
},
What I want to achieve is:
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
//The condition may be something else
if (this.model=='my_module.my_model'){
// Do a specific action here
}
else{
this._super(event);
}
},
I have tried following, but the console.log('Test')
output is never displayed
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_onRowClicked: function (event) {
console.log('Test');
},
})
Any idea on how I can achieve this?
Thanks in advance!!
javascript odoo-11
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a situation where I need to take a specific action when a row is clicked in a tree view for a given model. The problem is with the rewriting of the Odoo JS framework in V11, the method I am interested in is declared private. Here the method I want to override from the list_renderer.js
file.
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
// The special_click property explicitely allow events to bubble all
// the way up to bootstrap's level rather than being stopped earlier.
if (!$(event.target).prop('special_click')) {
var id = $(event.currentTarget).data('id');
if (id) {
this.trigger_up('open_record', {id:id, target: event.target});
}
}
},
What I want to achieve is:
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
//The condition may be something else
if (this.model=='my_module.my_model'){
// Do a specific action here
}
else{
this._super(event);
}
},
I have tried following, but the console.log('Test')
output is never displayed
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_onRowClicked: function (event) {
console.log('Test');
},
})
Any idea on how I can achieve this?
Thanks in advance!!
javascript odoo-11
I have a situation where I need to take a specific action when a row is clicked in a tree view for a given model. The problem is with the rewriting of the Odoo JS framework in V11, the method I am interested in is declared private. Here the method I want to override from the list_renderer.js
file.
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
// The special_click property explicitely allow events to bubble all
// the way up to bootstrap's level rather than being stopped earlier.
if (!$(event.target).prop('special_click')) {
var id = $(event.currentTarget).data('id');
if (id) {
this.trigger_up('open_record', {id:id, target: event.target});
}
}
},
What I want to achieve is:
/**
* @private
* @param {MouseEvent} event
*/
_onRowClicked: function (event) {
//The condition may be something else
if (this.model=='my_module.my_model'){
// Do a specific action here
}
else{
this._super(event);
}
},
I have tried following, but the console.log('Test')
output is never displayed
var ListRenderer = require('web.ListRenderer');
ListRenderer.include({
_onRowClicked: function (event) {
console.log('Test');
},
})
Any idea on how I can achieve this?
Thanks in advance!!
javascript odoo-11
javascript odoo-11
edited Nov 8 at 15:03
asked Nov 8 at 11:05
guidev224
6810
6810
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206478%2foverriding-odoo-11-javascript-private-method%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown