Skip to Content
Menu
This question has been flagged
3 Replies
3906 Views

Hi,

I need to add a new menu item after the "Preference" which is on the top right corner of odoo.How can i add a menu item on that menu(menu appearing while clicking on that user).

Avatar
Discard
Author

Thanks @Cybrosys Techno Solutions @Niyas Raphy

Best Answer

Hi,

Try the following code(which add a new menu item named "User Manual") for adding new menuitem on the top-right user menu

In .xml

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-extend="UserMenu.Actions">
<t t-jquery="a[data-menu='settings']" t-operation="after">
<a role="menuitem" href="#" data-menu="manual" class="dropdown-item">User Manual</a>
</t>
</t>
</templates>

in.js

odoo.define('documentation.data', function (require) {
"use strict";


var page=require('web.UserMenu');
var ajax = require('web.ajax');
var rpc = require('web.rpc');
var usepage=page.include({
_onMenuManual: function () {
var base_url = window.location.origin;
window.open(base_url + '/user_manual/', '_blank');
},
})

});

Regards

Avatar
Discard
Best Answer

Hi,

See the sample code of adding new item there,


<t t-extend="UserMenu.Actions">
<t t-jquery=".dropdown-divider" t-operation="before">
<a role="menuitem" href="#" data-menu="shortcuts" class="dropdown-item d-none d-md-inline-block">Shortcuts</a>
</t>
</t>


You can get the detailed explanation in this answer: https://www.odoo.com/forum/help-1/question/how-to-customize-user-menu-in-odoo-11-135608


Also as an example refer this v12 module which add new option there, you can download and see the code : https://apps.odoo.com/apps/modules/12.0/app_odoo_customize/



Thanks

Avatar
Discard
Best Answer

May be this will helpful

 
 

Avatar
Discard