Skip to Content
Menu
This question has been flagged
6 Replies
8351 Views

Screenshot from 2020-01-20 17-12-26.png

I want to hide Update Score option for this view.

Screenshot from 2020-01-20 17-15-06.png


I  want to hide Publish Appraisal Option for this view.

Avatar
Discard
Best Answer

if u can't do it with python or xml please refer the code in github

its my module
if any access issue msg here

https://github.com/shalinwilson/car/blob/master/odoo_code/kims_cleanup/static/src/js/disable_export_group.js

Avatar
Discard

odoo.define("kims_cleanup", function(require) {

"use strict";

var core = require("web.core");

var Sidebar = require("web.Sidebar");

var session = require("web.session");

var _t = core._t;

Sidebar.include({

_addItems: function (sectionCode, items) {

var _items = items;

if (!session.is_superuser && sectionCode === 'other' && items.length) {

_items = _.reject(_items, {label:_t("Export")});

_items = _.reject(_items, {label:_t("Archive")});

_items = _.reject(_items, {label:_t("Unarchive")});

_items = _.reject(_items, {label:_t("Delete")});

_items = _.reject(_items, {label:_t("Portal Access Management")});

_items = _.reject(_items, {label:_t("Send SMS")});

_items = _.reject(_items, {label:_t("Partner Mass Mailing")});

}

this._super(sectionCode, _items);

},

});

});

Author

Thanks for your comment Shalin. I can't access github, It is showing error page.

i ll mail the module for you

The given link is not working.

Best Answer

I am using the same code for hiding a menu. It is hiding when I refresh the browser but it is not working when moving from one record to another.



odoo.define("gsop.hide_server_action_menu", function(require) {
"use strict";

var core = require("web.core");
var Sidebar = require("web.Sidebar");
var session = require("web.session");
var rpc = require("web.rpc");
var ListRenderer = require('web.ListRenderer');
var _t = core._t;

Sidebar.include({
_addItems: function (sectionCode, items) {

var _items = items;
console.log("hide_server_action_menu");
var href = window.location.href;
if (href.includes('res.partner') && href.includes('view_type=form')) {
var self = this;
var activeId = window.location.href.split("id=")[1].split("&")[0];
var url1 = '/search_visibility';
var xhr1 = new XMLHttpRequest();
xhr1.open("POST", url1, false);
xhr1.setRequestHeader("Content-Type", "application/json");
console.log('OPENED', xhr1.readyState);
xhr1.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
var resp = JSON.parse(this.responseText);
var result = JSON.parse(resp.result);
console.log(result);
if (result.account == true){
console.log("Visible");
}else{
console.log(" Not Visible");
_items = _.reject(_items, {label:_t("Send Teaser Email")});
self . _super ( sectionCode , _items );
}
}
}
var data = {
'params' : {
'hRef' : window . rental . href ,
'activeId' : activeId ,
'model' : 'res.partner' ,
}
};
xhr1 . send ( JSON . stringify ( data ));
}
this . _super ( sectionCode , _items );
},
});
});
Avatar
Discard