Fix tests

This commit is contained in:
Saif Ur Rehman 2019-01-06 18:14:18 +05:00
parent 7ea6554f1f
commit 13a6c0aeff
6 changed files with 16 additions and 11 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -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", [])

View File

@ -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)