minor fix

This commit is contained in:
Nabin Hait 2014-06-12 15:20:47 +05:30
parent e7f2d3179d
commit f2202fc014

View File

@ -197,6 +197,8 @@ class StockEntry(StockController):
if not self.posting_date or not self.posting_time:
frappe.throw(_("Posting date and posting time is mandatory"))
allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
for d in self.get('mtn_details'):
args = frappe._dict({
"item_code": d.item_code,
@ -209,7 +211,8 @@ class StockEntry(StockController):
# get actual stock at source warehouse
d.actual_qty = get_previous_sle(args).get("qty_after_transaction") or 0
if d.s_warehouse and d.actual_qty <= d.transfer_qty:
if d.s_warehouse and not allow_negative_stock and d.actual_qty <= d.transfer_qty:
frappe.throw(_("""Row {0}: Qty not avalable in warehouse {1} on {2} {3}.
Available Qty: {4}, Transfer Qty: {5}""").format(d.idx, d.s_warehouse,
self.posting_date, self.posting_time, d.actual_qty, d.transfer_qty))