I want to hide the products action button from normal users, How can I do it? can someone know?? don't need AI answers, i tried but not working.
La domanda è stata contrassegnata
Hello Kalana Piyumantha,
To hide the "Action" button on the product form view for normal users in Odoo, you can override the behavior using a small JavaScript patch.
Step 1: Create a JS file
Add a new JavaScript file in your module (e.g., static/src/js/hide_action_menu.js) and include the following code:
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { FormController } from "@web/views/form/form_controller";
import { user } from "@web/core/user";
patch(FormController.prototype, {
getStaticActionMenuItems() {
if (
this.props.resModel === "product.template" &&
!user.isSystem
) {
return {};
}
return super.getStaticActionMenuItems(...arguments);
},
});
Step 2: Load the JS in Manifest
Add the JS file to your module’s __manifest__.py:
'assets': {
'web.assets_backend': [
'your_module_name/static/src/js/hide_action_menu.js',
],
},If you have any questions, feel free to reach out.
Hope this helps!
Thanks and Regards,
Email: odoo@aktivsoftware.com
Hello Kalana Piyumatha
you can check below link if it is according to your requirement.
https://apps.odoo.com/apps/modules/19.0/gt_hide_action_menu
Thank you!
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati| Post correlati | Risposte | Visualizzazioni | Attività | |
|---|---|---|---|---|
|
|
0
set 25
|
2798 | ||
|
How do you create a button?
Risolto
|
|
3
apr 17
|
4780 | |
|
|
0
apr 17
|
6974 | ||
|
|
1
apr 26
|
753 | ||
|
|
3
dic 25
|
1251 |
to (Jainesh Shah(Aktiv Software))'s answer,
do i want to create a user groups to this?? because I wanted to restrict this to normal users and also, give access to selected users
Hi Kalana Piyumantha
If you want to give access to non-admin users, then you need to create a custom user group.
This will allow you to hide it for normal users while giving access only to selected users by assigning the group.
Also, you will need to update your JS code to check this group so that it works according to your requirement.
Regards,
Hello,
Visit my answer:https://www.odoo.com/forum/help-1/hide-duplicate-and-delete-button-per-user-294653
You need to do little changes in code as per your requirement.
Let me know if you need assistance regarding this.
Thanks
info@codespheretech.in