From fd5ce9ca10e8da650455a4eb62a620b7f8729ef7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:12:03 +0530 Subject: [PATCH] fix: dont attempt to set batch number if item doesn't have batch no (#29812) (#29813) This causes other triggers and unnecessary changes (e.g. price list) (cherry picked from commit f89a64db486b46ac756d5ba62faee87f28baf889) Co-authored-by: Ankush Menat --- erpnext/selling/sales_common.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index e2c752cecfa..8ef71ca86a1 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -227,11 +227,11 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }, callback:function(r){ if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { - if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; - - me.set_batch_number(cdt, cdn); - me.batch_no(doc, cdt, cdn); + if (has_batch_no) { + me.set_batch_number(cdt, cdn); + me.batch_no(doc, cdt, cdn); + } } } });