Try ERPNext Buy Support Partners Foundation

Batch no issue when creating new row in child table

Hello, I use this code snippet to create a new row in Delivery Note Item grid. The issue is, ERPNext changes my batch number to something else.

rowItem = frappe.model.add_child(frm.doc, 'Delivery Note Item', 'items');

frappe.model.set_value(rowItem.doctype,, 'item_code', strItemCode);
frappe.model.set_value(rowItem.doctype,, 'uom', strItemUOM);
frappe.model.set_value(rowItem.doctype,, 'batch_no', strBatchName);
frappe.model.set_value(rowItem.doctype,, 'qty', flBatchQty);
frappe.model.set_value(rowItem.doctype,, 'against_sales_order', strSaleOrderName);
frappe.model.set_value(rowItem.doctype,, 'so_detail', strSaleOrderLineName);
  • We have disabled the “set_batch_number” in “sales_common.js” file but somehow ERPNext still changes it.
  • The rows which are created by “Get Items from Sales Order” doesn’t have this issue. I can set a batch number in these rows but when I creating new rows, my batch numbers changes.

What can we try to prevent changing batch numbers in the row?