From 93fdc670fe6fd340f5a7a0ab82ac7e4972b3d740 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 11 Feb 2014 14:40:21 +0530 Subject: [PATCH] Fixes in Test Cases --- .../test_sales_taxes_and_charges_master.py | 9 ++- .../shipping_rule/test_shipping_rule.py | 75 ++++++++++++++++++- erpnext/accounts/utils.py | 2 +- .../setup/doctype/territory/test_territory.py | 2 +- .../doctype/price_list/test_price_list.py | 4 +- .../support/doctype/newsletter/newsletter.py | 1 + 6 files changed, 86 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py index ee753d5e8be..670edc44e00 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/test_sales_taxes_and_charges_master.py @@ -28,6 +28,11 @@ test_records = [ "doctype": "Applicable Territory", "parentfield": "valid_for_territories", "territory": "All Territories" + }, + { + "doctype": "Applicable Territory", + "parentfield": "valid_for_territories", + "territory": "_Test Territory Rest Of The World" } ], [ @@ -121,7 +126,7 @@ test_records = [ [ { "doctype": "Sales Taxes and Charges Master", - "title": "_Test Sales Taxes and Charges Master 2", + "title": "_Test Sales Taxes and Charges Master - Rest of the World", "company": "_Test Company" }, { @@ -143,7 +148,7 @@ test_records = [ { "doctype": "Applicable Territory", "parentfield": "valid_for_territories", - "territory": "All Territories" + "territory": "_Test Territory Rest Of The World" } ], ] \ No newline at end of file diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index 6bf6bd386e3..ad99a516f34 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -36,6 +36,7 @@ test_records = [ { "doctype": "Shipping Rule", "label": "_Test Shipping Rule", + "name": "_Test Shipping Rule", "calculate_based_on": "Net Total", "company": "_Test Company", "account": "_Test Account Shipping Charges - _TC", @@ -66,5 +67,77 @@ test_records = [ "parentfield": "valid_for_territories", "territory": "_Test Territory" } - ] + ], + [ + { + "doctype": "Shipping Rule", + "name": "_Test Shipping Rule - India", + "label": "_Test Shipping Rule - India", + "calculate_based_on": "Net Total", + "company": "_Test Company", + "account": "_Test Account Shipping Charges - _TC", + "cost_center": "_Test Cost Center - _TC" + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 0, + "to_value": 100, + "shipping_amount": 50.0 + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 101, + "to_value": 200, + "shipping_amount": 100.0 + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 201, + "shipping_amount": 0.0 + }, + { + "doctype": "Applicable Territory", + "parentfield": "valid_for_territories", + "territory": "_Test Territory India" + } + ], + [ + { + "doctype": "Shipping Rule", + "name": "_Test Shipping Rule - Rest of the World", + "label": "_Test Shipping Rule - Rest of the World", + "calculate_based_on": "Net Total", + "company": "_Test Company", + "account": "_Test Account Shipping Charges - _TC", + "cost_center": "_Test Cost Center - _TC" + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 0, + "to_value": 1000, + "shipping_amount": 500.0 + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 1001, + "to_value": 2000, + "shipping_amount": 1000.0 + }, + { + "doctype": "Shipping Rule Condition", + "parentfield": "shipping_rule_conditions", + "from_value": 2001, + "shipping_amount": 1500.0 + }, + { + "doctype": "Applicable Territory", + "parentfield": "valid_for_territories", + "territory": "_Test Territory Rest Of The World" + } + ], ] \ No newline at end of file diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 495284a7bfd..9f6545247aa 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -370,7 +370,7 @@ def rename_account_for(dt, olddn, newdn, merge, company): webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn) def add_abbr_if_missing(dn, company): - from setup.doctype.company.company import get_name_with_abbr + from ..setup.doctype.company.company import get_name_with_abbr return get_name_with_abbr(dn, company) def get_account_for(account_for_doctype, account_for): diff --git a/erpnext/setup/doctype/territory/test_territory.py b/erpnext/setup/doctype/territory/test_territory.py index 54d99eda820..3068b5f969c 100644 --- a/erpnext/setup/doctype/territory/test_territory.py +++ b/erpnext/setup/doctype/territory/test_territory.py @@ -22,7 +22,7 @@ test_records = [ }], [{ "doctype": "Territory", - "territory_name": "_Test Territory Rest of the World", + "territory_name": "_Test Territory Rest Of The World", "parent_territory": "All Territories", "is_group": "No", }], diff --git a/erpnext/stock/doctype/price_list/test_price_list.py b/erpnext/stock/doctype/price_list/test_price_list.py index 803be27e5ca..c601b77d2dd 100644 --- a/erpnext/stock/doctype/price_list/test_price_list.py +++ b/erpnext/stock/doctype/price_list/test_price_list.py @@ -32,7 +32,7 @@ test_records = [ { "doctype": "Applicable Territory", "parentfield": "valid_for_territories", - "territory": "_Test Territory Rest of the World" + "territory": "_Test Territory Rest Of The World" } ], [ @@ -60,7 +60,7 @@ test_records = [ { "doctype": "Applicable Territory", "parentfield": "valid_for_territories", - "territory": "_Test Territory Rest of the World" + "territory": "_Test Territory Rest Of The World" }, { "doctype": "Applicable Territory", diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py index 68f1d95285e..9fbb5c48571 100644 --- a/erpnext/support/doctype/newsletter/newsletter.py +++ b/erpnext/support/doctype/newsletter/newsletter.py @@ -44,6 +44,7 @@ class DocType(): webnotes.conn.set(self.doc, "email_sent", 1) def get_recipients(self): + self.email_field = None if self.doc.send_to_type=="Contact": self.send_to_doctype = "Contact" if self.doc.contact_type == "Customer":