From 12aa4265ff24c63232d9677689cd991057ec06ae Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 12 Mar 2018 11:20:30 +0530 Subject: [PATCH] Don't allow to set negative quantity if transaction is not return entry (#13255) --- erpnext/controllers/status_updater.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index b46c752aa6..df0fec833d 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -156,6 +156,9 @@ class StatusUpdater(Document): # get unique transactions to update for d in self.get_all_children(): + if hasattr(d, 'qty') and d.qty < 0 and not self.get('is_return'): + frappe.throw(_("For an item {0}, quantity must be positive number").format(d.item_code)) + if d.doctype == args['source_dt'] and d.get(args["join_field"]): args['name'] = d.get(args['join_field'])