From 22ffdb9e7704d022b8347fff38d4f34140045835 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 1 Apr 2025 14:15:47 +0530 Subject: [PATCH] fix: remove all serial/batch fields when use button is unselected --- erpnext/public/js/controllers/transaction.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 6003b893ef0..becc6c18725 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -251,6 +251,15 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } } + use_serial_batch_fields(frm, cdt, cdn) { + const item = locals[cdt][cdn]; + if (!item.use_serial_batch_fields) { + frappe.model.set_value(cdt, cdn, "serial_no", ""); + frappe.model.set_value(cdt, cdn, "batch_no", ""); + frappe.model.set_value(cdt, cdn, "rejected_serial_no", ""); + } + } + set_fields_onload_for_line_item() { if (this.frm.is_new() && this.frm.doc?.items) { this.frm.doc.items.forEach(item => {