From c525b372c6582d09b20b061f8795ee51bf7aed13 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 21 Jul 2021 22:28:32 +0530 Subject: [PATCH] fix: Tests --- .../purchase_invoice/test_purchase_invoice.py | 20 +++++++++---------- .../sales_invoice/test_sales_invoice.py | 9 +++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 7c26007b07..9de3012554 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -271,17 +271,16 @@ class TestPurchaseInvoice(unittest.TestCase): additional_discount_account = create_account(account_name="Discount Account", parent_account="Indirect Expenses - _TC", company="_Test Company") - pi = make_purchase_invoice(qty=1, rate=100, do_not_save=1) + pi = make_purchase_invoice(qty=1, rate=100, do_not_save=1, parent_cost_center="Main - _TC") pi.apply_discount_on = "Grand Total" pi.additional_discount_account = additional_discount_account pi.additional_discount_percentage = 20 pi.append("taxes", { - "charge_type": "On Net Total", - "account_head": "CGST - _TC", + "charge_type": "Actual", + "account_head": "_Test Account VAT - _TC", "cost_center": "Main - _TC", - "description": "CGST @ 9.0", - "base_tax_amount": 20, - "base_tax_amount_after_discount_amount": 20 + "description": "Test", + "tax_amount": 20 }) pi.submit() @@ -294,10 +293,10 @@ class TestPurchaseInvoice(unittest.TestCase): # print(gl, "\n") expected_gle = [ - ["CGST - _TC", 20.0, 0.0, nowdate()], + ["_Test Account Cost for Goods Sold - _TC", 100.0, 0.0, nowdate()], + ["_Test Account VAT - _TC", 20.0, 0.0, nowdate()], ["Creditors - _TC", 0.0, 96.0, nowdate()], - ["Discount Account - _TC", 0.0, 24.0, nowdate()], - ["_Test Account Cost for Goods Sold - _TC", 100.0, 0.0, nowdate()] + ["Discount Account - _TC", 0.0, 24.0, nowdate()] ] check_gl_entries(self, pi.name, expected_gle, nowdate()) @@ -1218,6 +1217,7 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date): where voucher_type='Purchase Invoice' and voucher_no=%s and posting_date >= %s order by posting_date asc, account asc""", (voucher_no, posting_date), as_dict=1) + print(gl_entries) for i, gle in enumerate(gl_entries): doc.assertEqual(expected_gle[i][0], gle.account) doc.assertEqual(expected_gle[i][1], gle.debit) @@ -1281,7 +1281,7 @@ def make_purchase_invoice(**args): pi.return_against = args.return_against pi.is_subcontracted = args.is_subcontracted or "No" pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC" - pi.cost_center = args.cost_center or "_Test Cost Center - _TC" + pi.cost_center = args.parent_cost_center pi.append("items", { "item_code": args.item or args.item_code or "_Test Item", diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index eccc69fdb2..6ee16f8e78 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -2045,16 +2045,17 @@ class TestSalesInvoice(unittest.TestCase): si.additional_discount_percentage = 20 si.append("taxes", { "charge_type": "Actual", - "account_head": "CGST - _TC", + "account_head": "_Test Account VAT - _TC", "cost_center": "Main - _TC", - "description": "CGST @ 9.0", + "parent_cost_center": "Main - _TC", + "description": "Test", "rate": 0, "tax_amount": 20 }) si.submit() expected_gle = [ - ["CGST - _TC", 0.0, 20.0, nowdate()], + ["_Test Account VAT - _TC", 0.0, 20.0, nowdate()], ["Debtors - _TC", 96.0, 0.0, nowdate()], ["Discount Account - _TC", 24.0, 0.0, nowdate()], ["Sales - _TC", 0.0, 100.0, nowdate()] @@ -2229,7 +2230,7 @@ def create_sales_invoice(**args): si.currency=args.currency or "INR" si.conversion_rate = args.conversion_rate or 1 si.naming_series = args.naming_series or "T-SINV-" - si.cost_center = args.cost_center or "_Test Cost Center - _TC" + si.cost_center = args.parent_cost_center si.append("items", { "item_code": args.item or args.item_code or "_Test Item",