From f2202fc01419f826d056a62e23879514b4a7d0e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 12 Jun 2014 15:20:47 +0530 Subject: [PATCH] minor fix --- erpnext/stock/doctype/stock_entry/stock_entry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 2037117e05..d8164f7e21 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -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))