From 4c9525139d19690b9e596be004be7a2823f0b4d1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 24 Apr 2012 10:38:37 +0530 Subject: [PATCH] Error fixed in stock ledger netry batch related --- .../stock/doctype/stock_ledger_entry/stock_ledger_entry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index c9d23c69dd..58ad4c21c7 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -35,11 +35,12 @@ class DocType: def actual_amt_check(self): if self.doc.batch_no: batch_bal = flt(sql("select sum(actual_qty) from `tabStock Ledger Entry` where warehouse = '%s' and item_code = '%s' and batch_no = '%s'"%(self.doc.warehouse,self.doc.item_code,self.doc.batch_no))[0][0]) - + self.doc.fields.update({'batch_bal': batch_bal}) + if (batch_bal + self.doc.actual_qty) < 0: msgprint("""Not enough quantity (requested: %(actual_qty)s, current: %(batch_bal)s in Batch %(batch_no)s for Item %(item_code)s at Warehouse%(warehouse)s - as on %(posting_date)s %(posting_time)s""" % self.doc.fields.update({'batch_bal': batch_bal}), raise_exception = 1) + as on %(posting_date)s %(posting_time)s""" % self.doc.fields, raise_exception = 1) # mandatory