Privileges on table

how to add privilages on rows … no one can delete any row only adding rows is applicable


Please find below the client script of Sales Order Doctype, you can modify the same for your doctype:

// Client script to restrict delete lines on sales order doctype in erpnext
frappe.ui.form.on('Sales Order', {
    // Trigger when the form is loaded
    onload: function(frm) {
        // Check if the user has the role of Sales Manager
        if (!frappe.user.has_role('Sales Manager')) {
            // Loop through the items table
            frm.doc.items.forEach(function(row) {
                // Disable the delete button for each row
                frm.fields_dict.items.grid.toggle_enable('remove', false,;


Divyesh M.

Hi @GhadaEbrahim,

Please apply the client script for it.

frappe.ui.form.on("Your DocType", {
    refresh: function(frm) {
        frm.set_df_property('your_child_table_name', 'cannot_delete_rows', true);

Role wise set for use

Please set your doctype and child table name according.

Thank You!

1 Like

Thanks … its working

i have another issue … i tried to remove edit option but still its editable … then i make it read only its working but its removed add row option.

This is my code:

frappe.ui.form.on(“Supplier”, {
refresh: function(frm) {

    frm.set_df_property("case_status_", "read_only", frm.is_new() ? 0 : 1);


Please check it.

Thank You!

I have tried this … its remove edit option but still i can edit data

Any other solution?