[fix] Batch selected in the sales transaction for non batch item (#11713)

This commit is contained in:
rohitwaghchaure 2017-11-24 10:46:27 +05:30 committed by Nabin Hait
parent 82ef26b327
commit 15f8fe0179
2 changed files with 2 additions and 2 deletions

View File

@ -355,7 +355,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
*/
set_batch_number: function(cdt, cdn) {
const doc = frappe.get_doc(cdt, cdn);
if(doc) {
if (doc && doc.has_batch_no) {
this._set_batch_number(doc);
}
},

View File

@ -149,7 +149,7 @@ def get_batches(item_code, warehouse, qty=1, throw=False):
'select batch_id, sum(actual_qty) as qty from `tabBatch` join `tabStock Ledger Entry` '
'on `tabBatch`.batch_id = `tabStock Ledger Entry`.batch_no '
'where `tabStock Ledger Entry`.item_code = %s and `tabStock Ledger Entry`.warehouse = %s '
'and `tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL '
'and (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL)'
'group by batch_id '
'order by `tabBatch`.expiry_date DESC, `tabBatch`.creation ASC',
(item_code, warehouse),