Only custom option in the link field


I am trying to link a field to the ‘Traite’ doctype and I add a custom option to the link field. How can I hide ‘Create a new Traite’ and ‘Advanced Search’ options from the link, and only the custom option remains

Capture d’écran du 2023-11-20 16-17-09

the custom option here is Recherche avancé

Use “Role Permission Manager”
Uncheck “Create” option for that role.

1 Like

I want only to hide options and keep only the custom option for this field and not disable create permission to doctype


1 Like
frappe.ui.form.on('Your DocType', {
    refresh: function(frm) {
        frm.fields_dict['your_link_fieldname'].get_query = function(doc, cdt, cdn) {
            return {
                filters: {
                    // Your filters go here
                no_create: 1, // Disable "Create New Item"
                query: 'erpnext.controllers.queries.linked_document_query',
                searchfield: 'item_code'
1 Like

i do it but not work

Try this


cur_frm.set_df_proprty(<YOUR_FIELDNAME>, "only_select", 1)

my fieldname is employee

cur_frm.set_df_property('employee', 'only_select', 1)
1 Like