From e761fe89e22b131fc084f19b0ad6b01c797189c3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 27 Dec 2013 17:35:39 +0530 Subject: [PATCH] Stock Entry catch exceptions for testcase --- accounts/doctype/sales_invoice/test_sales_invoice.py | 1 - stock/doctype/stock_entry/stock_entry.py | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index 9b740d1061b..5a573f94416 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -364,7 +364,6 @@ class TestSalesInvoice(unittest.TestCase): from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s order by account asc, debit asc""", si.doc.name, as_dict=1) self.assertTrue(gl_entries) - # print gl_entries stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"}) diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index 2e7e2a40665..7dec8785c4d 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -290,11 +290,12 @@ class DocType(StockController): if not returnable_qty: webnotes.throw("{item}: {item_code} {returned}".format( item=_("Item"), item_code=item.item_code, - returned=_("already returned though some other documents"))) + returned=_("already returned though some other documents")), + StockOverReturnError) elif item.transfer_qty > returnable_qty: webnotes.throw("{item}: {item_code}, {returned}: {qty}".format( item=_("Item"), item_code=item.item_code, - returned=_("Max Returnable Qty"), qty=returnable_qty)) + returned=_("Max Returnable Qty"), qty=returnable_qty), StockOverReturnError) def get_already_returned_item_qty(self, ref_fieldname): return dict(webnotes.conn.sql("""select item_code, sum(transfer_qty) as qty