update get_batch_no query to sort batch with expiry date
small fix to avoid error msg if item_code not selected and batch_no is entered
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 1c5df6e..fa831ae 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -481,16 +481,18 @@
batch_no: function(doc, cdt, cdn) {
var me = this;
var item = frappe.get_doc(cdt, cdn);
- return this.frm.call({
- method: "erpnext.stock.get_item_details.get_batch_qty",
- child: item,
- args: {
- "batch_no": item.batch_no,
- "warehouse": item.warehouse,
- "item_code": item.item_code
- },
- "fieldname": "actual_batch_qty"
- });
+ if(item.item_code) {
+ return this.frm.call({
+ method: "erpnext.stock.get_item_details.get_batch_qty",
+ child: item,
+ args: {
+ "batch_no": item.batch_no,
+ "warehouse": item.warehouse,
+ "item_code": item.item_code
+ },
+ "fieldname": "actual_batch_qty"
+ });
+ }
},
set_dynamic_labels: function() {