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.
Esta pergunta foi sinalizada
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!
Está gostando da discussão? Não fique apenas lendo, participe!
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscrever-se| Publicações relacionadas | Respostas | Visualizações | Atividade | |
|---|---|---|---|---|
|
|
0
set. 25
|
2799 | ||
|
How do you create a button?
Resolvido
|
|
3
abr. 17
|
4780 | |
|
|
0
abr. 17
|
6974 | ||
|
|
1
abr. 26
|
754 | ||
|
|
3
dez. 25
|
1259 |
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