From c8a0de5e599d65b1ab9cedf7b6b424cf5e2d604b Mon Sep 17 00:00:00 2001
From: Rushabh Mehta <rmehta@gmail.com>
Date: Fri, 16 Jun 2017 11:18:23 +0530
Subject: [PATCH] Revert "sets tax category to "Total" if all items are
 non-stock items (#9295)" (#9320)

This reverts commit 476c4fec1d2943ded83faeb7bb07045c27ae2e35.
---
 erpnext/controllers/buying_controller.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 2e842c5428..5bc8bb38f8 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -73,14 +73,10 @@ class BuyingController(StockController):
 
 	def validate_stock_or_nonstock_items(self):
 		if self.meta.get_field("taxes") and not self.get_stock_items():
-			tax_for_valuation = [d for d in self.get("taxes")
+			tax_for_valuation = [d.account_head for d in self.get("taxes")
 				if d.category in ["Valuation", "Valuation and Total"]]
-
 			if tax_for_valuation:
-				for d in tax_for_valuation:
-					d.db_set("category", 'Total')
-				msgprint("Tax Category has been changed to \"Total\" because all Items in the Purchase Order "
-							"are non-stock items")
+				frappe.throw(_("Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"))
 
 	def set_landed_cost_voucher_amount(self):
 		for d in self.get("items"):