Issue with Making basic_rate Field Editable in Stock Entry Detail Rows on Item Addition


Hello, Frappe/ERPNext Community,

I am facing an issue with a custom implementation in ERPNext where I need to make the basic_rate field manually editable in the Stock Entry Detail rows immediately upon adding a new item. Despite setting a custom flag (set_basic_rate_manually = 1) to indicate that the basic_rate should be manually editable, the field does not become editable until I manually open and then close the item detail form. Here is a brief overview of the problem and what I’ve attempted so far.


  • After programmatically adding a new row to the Stock Entry Detail table, the basic_rate field remains non-editable, despite setting a flag on the row to indicate it should be manually editable (set_basic_rate_manually = 1).
  • The field only becomes editable after I open the row in the detailed view and then close it, which is not an acceptable workflow for end-users.

Steps Tried:

  1. I have attempted to adjust the items_add and form_render triggers in frappe.ui.form.on('Stock Entry Detail', {...}) to set set_basic_rate_manually and make basic_rate editable upon adding a new row or rendering the form.
items_add: function(frm, cdt, cdn) {
    var child = locals[cdt][cdn];
    frappe.model.set_value(cdt, cdn, 'set_basic_rate_manually', 1);
    frm.fields_dict['items'].grid.grid_rows_by_docname[cdn].toggle_editable('basic_rate', true);

form_render: function(frm, cdt, cdn) {
    var child = locals[cdt][cdn];
    if (child.set_basic_rate_manually == 1) {
        frm.fields_dict['items'].grid.grid_rows_by_docname[cdn].toggle_editable('basic_rate', true);
  1. I’ve ensured that the set_basic_rate_manually field is correctly set and confirmed that the script correctly targets the basic_rate field for editability.
  2. Additionally, I’ve tried forcing a refresh on the grid and individual fields after adding a row but to no avail.

Request for Help:

Has anyone encountered a similar issue or does anyone have insights into what might be going wrong here? I am looking for a way to make the basic_rate field immediately editable upon adding a new item to the Stock Entry Detail without requiring manual intervention to open and close the row detail form.

Any suggestions, code snippets, or guidance on how to resolve this issue would be greatly appreciated.

Thank you in advance for your help!