I was trying to hide some buttons in actions, but I couldn't find the duplicate and delete buttons in the Odoo 18 repository. Does anyone know how I could hide these functions per user?
لقد تم الإبلاغ عن هذا السؤال
3
الردود
1256
أدوات العرض
Hello,
You can hide like this
/** @odoo-module **/
You can hide like this
/** @odoo-module **/
import {patch} from "@web/core/utils/patch";
import {ActionMenus} from "@web/search/action_menus/action_menus";
import {useService} from "@web/core/utils/hooks";
import { user } from "@web/core/user";
patch(ActionMenus.prototype, {
setup(...args) {
super.setup(...args);
this.user = user
},
async getActionItems(props) {
let result = await super.getActionItems(...arguments)
const isAdmin = this.user.isAdmin
const user_group = await this.user.hasGroup("group_id");[as per your requirement]
const user_group = await this.user.hasGroup("group_id");[as per your requirement]
if (!isAdmin && user_group) {
result = result.filter(item => item.key !== 'delete' && item.key !== 'duplicate');
}
return result
}
});
Hope this helps.
thanks for the help, it worked!!
Hi,
Please go through the following module,
* https://apps.odoo.com/apps/modules/17.0/model_access_rights
* https://odoo-community.org/shop/hide-duplicate-button-3413#attr=5758
Hope it helps
I migrated the module to v18 and it worked, it wasn't exactly what I was looking for, but thanks anyway!!
You can disable a user's ability to edit or delete records by removing the Edit and Unlink permissions for the corresponding user group in the Model Access (ir.model.access) settings.
Once these permissions are removed, the corresponding Edit and Delete menu options will automatically be hidden for that user.
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيل| المنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
|---|---|---|---|---|
|
|
0
مارس 15
|
4767 | ||
|
|
2
مارس 26
|
1153 | ||
|
|
0
يونيو 26
|
1 | ||
|
|
0
يونيو 26
|
282 | ||
|
|
0
يونيو 26
|
1 |