odoo.define('list_view_print_button_hide', function (require) {
"use strict";
var ListController = require('web.ListController');
ListController.include({
_getActionMenuItems: function (state) {
// 可以换成group_id, 设置条件, 只需要改动toolbarActions
if (this.modelName === 'stock.picking'){
this.toolbarActions.print = []
}
return this._super.apply(this, arguments);
}
})
})
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~修正~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@@@@@@@@产品模板举例
ListController.include({ init: function (parent, model, renderer, params) { this.isActionEnable = false; this.isPrintEnable = false; this._super.apply(this, arguments); }, _getActionMenuItems: function (state) { var pros = this._super.apply(this, arguments); if ((this.modelName === 'product.product' || this.modelName === 'product.template') && pros) { if (!this.isActionEnable) { pros.items.action = [] pros.items.other = [] } if (!this.isPrintEnable) { pros.items.print = [] } } return pros; }, willStart() { var self = this; session.user_has_group('product_extra.group_product_action_dropdown').then(function (has_group) { if (has_group) { self.isActionEnable = true; } }); session.user_has_group('product_extra.group_product_print_dropdown').then(function (has_group) { if (has_group) { self.isPrintEnable = true; } }); return this._super.apply(this, arguments); } });