Thursday 10 March 2016

How to make child table field read only?

Using below code, one can set child table field read only.


Syntax
 
    var df = frappe.meta.get_docfield("CHILD TABLE DOCTYPE","FIELD NAME", cur_frm.doc.name);
    df.read_only = 1;



example:
 Using this, we can set item_name field read-only. This will helpful if you want to make fields read-only based on some condition

  frappe.ui.form.on("Sales Order","onload", function(frm, cdt, cdn) {
    var df = frappe.meta.get_docfield("Sales Order Item","item_name", cur_frm.doc.name);
    df.read_only = 1;

});

2 comments:

  1. Hi
    How to disable the specific rows on child doctype. This help to set all field rows as readonly

    ReplyDelete
  2. Please provide solution to disable whole row of child table

    ReplyDelete