In Odoo 9C, module website_quote.
I would like to override a event handler written in the website_quote, So far I have managed to override standard widgets, but however am not able to override an already overridden widget
Snippet from Standard Module (website_quote.js)
odoo.define('website_quote.website_quote', function (require) {
'use strict';
var ajax = require('web.ajax');
var Widget = require('web.Widget');
var website = require('website.website');
// Add to SO button
var UpdateLineButton = Widget.extend({
events: {
'click' : 'onClick',
},
onClick: function(ev){
ev.preventDefault();
var self = this;
var href = this.$el.attr("href");
var order_id = href.match(/order_id=([0-9]+)/);
var line_id = href.match(/update_line\/([0-9]+)/);
var token = href.match(/token=(.*)/);
ajax.jsonRpc("/quote/update_line", 'call', {
'line_id': line_id[1],
'order_id': parseInt(order_id[1]),
'token': token[1],
'remove': self.$el.is('[href*="remove"]'),
'unlink': self.$el.is('[href*="unlink"]'),
}).then(function (data) {
x;
if(!data){
location.reload();
}
self.$el.parents('.input-group:first').find('.js_quantity').val(data[0]);
$('[data-id="total_amount"]>span').html(data[1]);
});
return false;
},
});
var update_button_list = [];
$('a.js_update_line_json').each(function( index ) {
var button = new UpdateLineButton();
button.setElement($(this)).start();
update_button_list.push(button);
});
And In my custom module am trying to override "onClick" function of UpdateLineButton (which is already overridden from Widget). But somehow am not able achieve it.
odoo.define('MyModule.MyModule', function (require) { 'use strict'; var webQuote = require('website_quote.website_quote'); webQuote.UpdateLineButton.include({ events: { 'click' : 'onClick', }, onClick: function(ev){....} });
Any help appreciated. Thanks