From c663f5c2bd8bd524257ac077e1b3e1dd89cf3fd9 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 15 Sep 2015 15:36:21 +0530 Subject: [PATCH] [Test] test state based taxasion --- .../accounts/doctype/tax_rule/test_tax_rule.py | 18 ++++++++++++++---- erpnext/accounts/party.py | 1 - 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index 9802c09600..85fbe52220 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -73,13 +73,23 @@ class TestTaxRule(unittest.TestCase): "_Test Sales Taxes and Charges Template 2") def test_select_tax_rule_based_on_better_match(self): - make_tax_rule(customer= "_Test Customer", billing_city = "Test City", + make_tax_rule(customer= "_Test Customer", billing_city = "Test City", billing_state = "Test State", sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) - make_tax_rule(customer= "_Test Customer", + make_tax_rule(customer= "_Test Customer", billing_city = "Test City1", billing_state = "Test State", sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1) - self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City"}), + self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City", "billing_state": "Test State"}), + "_Test Sales Taxes and Charges Template") + + def test_select_tax_rule_based_on_state_match(self): + make_tax_rule(customer= "_Test Customer", shipping_state = "Test State", + sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) + + make_tax_rule(customer= "_Test Customer", shipping_state = "Test State12", + sales_tax_template = "_Test Sales Taxes and Charges Template 1", priority=2, save=1) + + self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "shipping_state": "Test State"}), "_Test Sales Taxes and Charges Template") def test_select_tax_rule_based_on_better_priority(self): @@ -93,7 +103,7 @@ class TestTaxRule(unittest.TestCase): "_Test Sales Taxes and Charges Template 1") def test_select_tax_rule_based_cross_matching_keys(self): - make_tax_rule(customer= "_Test Customer", billing_city = "Test City", + make_tax_rule(customer= "_Test Customer", billing_city = "Test City", sales_tax_template = "_Test Sales Taxes and Charges Template", save=1) make_tax_rule(customer= "_Test Customer 1", billing_city = "Test City 1", diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 8ad30583e1..a589a694dd 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -280,7 +280,6 @@ def validate_due_date(posting_date, due_date, party_type, party, company): @frappe.whitelist() def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None, billing_address=None, shipping_address=None, use_for_shopping_cart=None): - from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details args = { party_type: party,