Removed default taxes and charges from customer and supplier master. Added patch to create tax rules against customer/supplier
diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
index 873a4e3..9802c09 100644
--- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
@@ -19,7 +19,7 @@
self.assertRaises(IncorrectCustomerGroup, tax_rule.save)
def test_supplier_type(self):
- tax_rule = make_tax_rule(supplier= "_Test Supplier", supplier_type= "_Test Supplier Type 1",
+ tax_rule = make_tax_rule(tax_type= "Purchase", supplier= "_Test Supplier", supplier_type= "_Test Supplier Type 1",
purchase_tax_template = "_Test Purchase Taxes and Charges Template")
self.assertRaises(IncorrectSupplierType, tax_rule.save)
diff --git a/erpnext/patches/v5_8/tax_rule.py b/erpnext/patches/v5_8/tax_rule.py
new file mode 100644
index 0000000..b710ddc
--- /dev/null
+++ b/erpnext/patches/v5_8/tax_rule.py
@@ -0,0 +1,27 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ customers = frappe.db.sql("""select name, default_taxes_and_charges from tabCustomer where
+ ifnull(default_taxes_and_charges, '') != '' """, as_dict=1)
+
+ for d in customers:
+ tr = frappe.new_doc("Tax Rule")
+ tr.tax_type = "Sales"
+ tr.customer = d.name
+ tr.sales_tax_template = d.default_taxes_and_charges
+ tr.save()
+
+
+ suppliers = frappe.db.sql("""select name, default_taxes_and_charges from tabSupplier where
+ ifnull(default_taxes_and_charges, '') != '' """, as_dict=1)
+
+ for d in suppliers:
+ tr = frappe.new_doc("Tax Rule")
+ tr.tax_type = "Purchase"
+ tr.supplier = d.name
+ tr.purchase_tax_template = d.default_taxes_and_charges
+ tr.save()
\ No newline at end of file