try this way:
template>
div id="myDivElement">Click here to go to the menu item
/template>
JS:
odoo.define('my_module.my_view', function (require) {
'use strict';
var core = require('web.core');
$(document).ready(function () {
// Get the menu ID you want to redirect to
var menuID = YOUR_MENU_ITEM_ID;
// Add a click event listener to the div element
$('#myDivElement').on('click', function () {
// Redirect to the specified menu item
core.bus.trigger('menu_item_clicked', menuID);
});
});
});
Replace YOUR_MENU_ITEM_ID with the actual ID of the menu item you want to redirect to. When the user clicks on the div element, the event listener will be triggered, and it will call the core.bus.trigger method with the 'menu_item_clicked' event, which will navigate to the specified menu item without breaking the browser history.