[minor] raise EmptyStockReconciliationItemsError when no change in any of the items
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 413f820..efa6a8a 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -11,6 +11,7 @@
from erpnext.stock.utils import get_stock_balance
class OpeningEntryAccountError(frappe.ValidationError): pass
+class EmptyStockReconciliationItemsError(frappe.ValidationError): pass
class StockReconciliation(StockController):
def __init__(self, arg1, arg2=None):
@@ -51,7 +52,11 @@
items = filter(lambda d: _changed(d), self.items)
- if len(items) != len(self.items):
+ if not items:
+ frappe.throw(_("None of the items have any change in quantity or value."),
+ EmptyStockReconciliationItemsError)
+
+ elif len(items) != len(self.items):
self.items = items
for i, item in enumerate(self.items):
item.idx = i + 1