From 13a6c0aeff5f576eec9cbca31f4a3cd9a490803d Mon Sep 17 00:00:00 2001 From: Saif Ur Rehman Date: Sun, 6 Jan 2019 18:14:18 +0500 Subject: [PATCH] Fix tests --- .../accounts/doctype/purchase_invoice/test_records.json | 2 +- erpnext/accounts/doctype/sales_invoice/test_records.json | 4 ++-- erpnext/accounts/party.py | 5 +++-- erpnext/public/js/utils/party.js | 2 ++ erpnext/shopping_cart/cart.py | 7 ++++--- erpnext/shopping_cart/test_shopping_cart.py | 7 ++++--- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json index 7feca2380f..171927c182 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_records.json +++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json @@ -18,7 +18,7 @@ "expense_account": "_Test Account Cost for Goods Sold - _TC", "item_code": "_Test Item Home Desktop 100", "item_name": "_Test Item Home Desktop 100", - "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", + "item_tax_template": "_Test Account Excise Duty @ 10", "parentfield": "items", "qty": 10, "rate": 50, diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json index 0b7b76d1b3..9c8de7d5a2 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_records.json +++ b/erpnext/accounts/doctype/sales_invoice/test_records.json @@ -142,7 +142,7 @@ "expense_account": "_Test Account Cost for Goods Sold - _TC", "item_code": "_Test Item Home Desktop 100", "item_name": "_Test Item Home Desktop 100", - "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", + "item_tax_template": "_Test Account Excise Duty @ 10", "parentfield": "items", "price_list_rate": 50, "qty": 10, @@ -269,7 +269,7 @@ "expense_account": "_Test Account Cost for Goods Sold - _TC", "item_code": "_Test Item Home Desktop 100", "item_name": "_Test Item Home Desktop 100", - "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", + "item_tax_template": "_Test Account Excise Duty @ 10", "parentfield": "items", "price_list_rate": 62.5, "qty": 10, diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 594eea51a8..29a3bce7b9 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -51,8 +51,9 @@ def _get_party_details(party=None, account=None, party_type="Customer", company= out["tax_category"] = get_address_tax_category(party.get("tax_category"), party_address, shipping_address if party_type != "Supplier" else party_address) - out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, - out.supplier_group, out.tax_category, party_address, shipping_address) + out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, + customer_group=out.customer_group, supplier_group=out.supplier_group, tax_category=out.tax_category, + billing_address=party_address, shipping_address=shipping_address) if fetch_payment_terms_template: out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company) diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js index 05269311e2..44f9f24a91 100644 --- a/erpnext/public/js/utils/party.js +++ b/erpnext/public/js/utils/party.js @@ -169,6 +169,8 @@ erpnext.utils.set_taxes = function(frm, triggered_from_field) { "party_type": party_type, "posting_date": frm.doc.posting_date || frm.doc.transaction_date, "company": frm.doc.company, + "customer_group": frm.doc.customer_group, + "supplier_group": frm.doc.supplier_group, "tax_category": frm.doc.tax_category, "billing_address": ((frm.doc.customer || frm.doc.lead) ? (frm.doc.customer_address) : (frm.doc.supplier_address)), "shipping_address": frm.doc.shipping_address_name diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 254d7b74af..dc3700769a 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -303,9 +303,10 @@ def set_taxes(quotation, cart_settings): customer_group = frappe.db.get_value("Customer", quotation.customer, "customer_group") - quotation.taxes_and_charges = set_taxes(quotation.customer, "Customer", \ - quotation.transaction_date, quotation.company, customer_group, None, \ - quotation.customer_address, quotation.shipping_address_name, 1) + quotation.taxes_and_charges = set_taxes(quotation.customer, "Customer", + quotation.transaction_date, quotation.company, customer_group=customer_group, supplier_group=None, + tax_category=quotation.tax_category, billing_address=quotation.customer_address, + shipping_address=quotation.shipping_address_name, use_for_shopping_cart=1) # # # clear table quotation.set("taxes", []) diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index 7d6b41ef5f..daad799246 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -107,9 +107,10 @@ class TestShoppingCart(unittest.TestCase): from erpnext.accounts.party import set_taxes - tax_rule_master = set_taxes(quotation.customer, "Customer", \ - quotation.transaction_date, quotation.company, None, None, \ - quotation.customer_address, quotation.shipping_address_name, 1) + tax_rule_master = set_taxes(quotation.customer, "Customer", + quotation.transaction_date, quotation.company, customer_group=None, supplier_group=None, + tax_category=quotation.tax_category, billing_address=quotation.customer_address, + shipping_address=quotation.shipping_address_name, use_for_shopping_cart=1) self.assertEqual(quotation.taxes_and_charges, tax_rule_master) self.assertEqual(quotation.total_taxes_and_charges, 1000.0)