Skip to Content
Menu
This question has been flagged
4081 Views

The code below is the template which i had overided.


<t t-name="ProductScreenWidget">
<div class="product-screen screen">
<div class="windowbox">
Overiding ProductScreenWidget
<button class="mybutton" name="stock" type="object">
VIEW STOCK
</button>
        </div>
<div class="leftpane">
<div class='window'>
<div class='subwindow'>
<div class='subwindow-container'>
<div class='subwindow-container-fix'>
<div class="placeholder-OrderWidget"></div>
</div>
</div>
</div>

<div class='subwindow collapsed'>
<div class='subwindow-container'>
<div class='subwindow-container-fix pads'>

<div class="control-buttons oe_hidden"></div>
<div class="placeholder-ActionpadWidget"></div>
<div class="placeholder-NumpadWidget"></div>
</div>
</div>
</div>

</div>
</div>
<div class="rightpane">
<table class="layout-table">

<tr class="header-row">
<td class="header-cell">
<span class="placeholder-ProductCategoriesWidget" />
</td>
</tr>

<tr class="content-row">
<td class="content-cell">
<div class="content-container">
<span class="placeholder-ProductListWidget" />
</div>
</td>
</tr>

</table>
</div>
</div>
</t>

This is the new div and button which i had created.

<div class="windowbox">
Overiding ProductScreenWidget
<button class="mybutton" name="stock" type="object">
VIEW STOCK
</button>
<div>

Now i want to create an action for this button. or assume that i want to run some code when i click this particular button. i want to write the code in the js file.

Below is the js code which i had created in my js file.

var ViewStockMoves = screens.ProductScreenWidget.extend({
template: "ProductScreenWidget",

events: {
"click .stock": 'stock_moves_view',
},

stock_moves_view: function(){
var self = this;
// THE CODE WHICH I NEED TO EXECUTE
},


});
screens.define_action_button({'name': 'stock_moves_view','widget': ProductScreenWidget,});

In the above code ProductScreenWidget is the extended widget and the template name is  also the same. The name of the function is stock_moves_view.


I think the control is not coming to the desired function.


Please help.






Avatar
Discard