Skip to content

Commit

Permalink
[FIX] portal_sale_distributor: hide actions in tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
lef-adhoc committed May 3, 2024
1 parent 877df9f commit e46074d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion portal_sale_distributor/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Portal Distributor Sale',
'version': "16.0.1.5.0",
'version': "16.0.1.6.0",
'category': 'Tools',
'complexity': 'easy',
'author': 'ADHOC SA, Odoo Community Association (OCA)',
Expand Down Expand Up @@ -48,4 +48,9 @@
],
'installable': True,
'auto_install': False,
"assets": {
"web.assets_backend": [
"portal_sale_distributor/static/src/**/*",
]
},
}
21 changes: 21 additions & 0 deletions portal_sale_distributor/static/src/js/hideActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** @odoo-module **/

import { ListController } from "@web/views/list/list_controller";
import { patch } from "@web/core/utils/patch";
import { onWillStart } from "@odoo/owl";

patch(ListController.prototype, "hideActionsPatch", {
setup() {
this._super(...arguments);
onWillStart(async () => {
this.isUserInDistributorGroup = await this.userService.hasGroup("portal_sale_distributor.group_portal_backend_distributor");
});
},
getActionMenuItems() {
const actionMenuItems = this._super(...arguments);
if (this.isUserInDistributorGroup) {
actionMenuItems.other = [];
}
return actionMenuItems;
},
});

0 comments on commit e46074d

Please sign in to comment.