Hello everyone , I have a template index, and it t-call template panel and header.
In template header , I defined an event click but when I click button , there are not run event
Here is index.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="index">
<div>
<t t-call="header"/>
<t t-call="panel"/>
</div>
</t>
</templates>
Here is header.js
odoo.define('erpvn_action_scan.Header', function (require) {
"use strict";
var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var _t = core._t;
var Header = AbstractAction.extend({
contentTemplate: 'header',
events: {
"click .btn_home": "handleClickHome",
},
init: function(parent, action) {
this._super.apply(this, arguments);
},
willStart: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
});
},
start: function() {
var self = this;
return this._super.apply(this, arguments);
},
destroy: function () {
this._super();
},
_onBarcodeScanned: function(barcode) {
},
handleClickHome: function (e) {
alert('Home')
},
});
core.action_registry.add('header', Header);
return {
Header: Header,
};
});
But when I define event click in file index.js, it run and alert message.
So, when using t-call a template, why JS file of that template not working