From db33ebb0ffbf889dbfd6a81ad1f0cfc9512d6b69 Mon Sep 17 00:00:00 2001 From: RobertSchouten Date: Mon, 12 Sep 2016 14:54:46 +0800 Subject: [PATCH] [fix] status updater percent when qty is minus value --- erpnext/controllers/status_updater.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index ccbf377901..7be6acdf8a 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -245,8 +245,8 @@ class StatusUpdater(Document): frappe.db.sql("""update `tab%(target_parent_dt)s` set %(target_parent_field)s = round( ifnull((select - ifnull(sum(if(%(target_ref_field)s > %(target_field)s, %(target_field)s, %(target_ref_field)s)), 0) - / sum(%(target_ref_field)s) * 100 + ifnull(sum(if(%(target_ref_field)s > %(target_field)s, abs(%(target_field)s), abs(%(target_ref_field)s))), 0) + / sum(abs(%(target_ref_field)s)) * 100 from `tab%(target_dt)s` where parent="%(name)s"), 0), 2) %(update_modified)s where name='%(name)s'""" % args)