Javascript 覆盖odoo库存中的小部件

Javascript 覆盖odoo库存中的小部件,javascript,openerp,odoo-8,qweb,Javascript,Openerp,Odoo 8,Qweb,在库存模块中,条形码扫描仪页面由widget.js和picking.xml通过qweb处理 我需要覆盖行为以添加功能。到目前为止,我已经能够覆盖xml: <templates id="template" xml:space="preserve"> <t t-extend="PickingEditorWidget"> <t t-jquery="#js_packconf_select" t-operation="after"> <

在库存模块中,条形码扫描仪页面由widget.js和picking.xml通过qweb处理

我需要覆盖行为以添加功能。到目前为止,我已经能够覆盖xml:

<templates id="template" xml:space="preserve">
 <t t-extend="PickingEditorWidget">
     <t t-jquery="#js_packconf_select" t-operation="after">
         <p>Hello World!</p>
     </t>
 </t>
</templates>
我在每个模块中都看到了这种代码,那么,我如何改变(例如)这个函数的工作方式,而不必用我的小改动重写整个stock/widget.js呢

this.$('.js_pack_configure').click(function(){
  ....
})
我不是JS专家,我想不出来

编辑:

我在模块的清单中放入了依赖项中的stock模块,现在我看到了PickingEditorWidget对象,但仍然无法使其在我的更改中工作

我的代码(widget.js)是:

function openerp\u picking\u widgets\u extended(实例){
var module=instance.mrp\u extended;
module.PickingEditorWidgetExtended=instance.stock.PickingEditorWidget.include({
渲染:函数(){
这是。$('.js_pack_configure')。单击(函数(){
});
这是。$('.js_validate_pack')。单击(函数(){
});
这个;
},
});
}
openerp.mrp_extended=函数(openerp){
openerp.mrp_extended=openerp.mrp_extended |{};
openerp_拾取_小部件_扩展(openerp);
}

我通过以下方式修复了代码:

....
module.PickingEditorWidgetExtended = instance.stock.PickingEditorWidget.include({
    renderElement: function(){
        this._super();
....
function openerp_picking_widgets_extended(instance){

var module = instance.mrp_extended;

module.PickingEditorWidgetExtended = instance.stock.PickingEditorWidget.include({
    renderElement: function(){
        this.$('.js_pack_configure').click(function(){
            <my code>
        });
        this.$('.js_validate_pack').click(function(){
            <my code>
        });
        this._super();
    },
});

}

openerp.mrp_extended = function(openerp) {
  openerp.mrp_extended = openerp.mrp_extended || {};
  openerp_picking_widgets_extended(openerp);
}
....
module.PickingEditorWidgetExtended = instance.stock.PickingEditorWidget.include({
    renderElement: function(){
        this._super();
....