fix: Check all expected GL Entries

This commit is contained in:
GangaManoj 2021-07-17 17:34:50 +05:30
parent 6bff653cf0
commit b0f21824bc
2 changed files with 16 additions and 4 deletions

View File

@ -252,14 +252,21 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
def test_purchase_invoice_with_discount_accounting_enabled(self):
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import check_gl_entries
enable_discount_accounting()
discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
pi = make_purchase_invoice(discount_account=discount_account, discount_amount=100)
discount_amount = frappe.db.get_value('GL Entry', {'account': discount_account, 'voucher_no': pi.name}, 'credit')
self.assertEqual(discount_amount, 100)
expected_gle = [
["Discount Account - _TC", 0.0, 100.0, nowdate()],
["_Test Account Cost for Goods Sold - _TC", 350.0, 0.0, nowdate()],
["Creditors - _TC", 0.0, 250.0, nowdate()]
]
check_gl_entries(self, pi.name, expected_gle, nowdate())
def test_purchase_invoice_change_naming_series(self):
pi = frappe.copy_doc(test_records[1])

View File

@ -1992,9 +1992,14 @@ class TestSalesInvoice(unittest.TestCase):
discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
si = create_sales_invoice(discount_account=discount_account, discount_amount=100)
expected_gle = [
["Discount Account - _TC", 100.0, 0.0, nowdate()],
["Sales - _TC", 0.0, 200.0, nowdate()],
["Debtors - _TC", 100.0, 0.0, nowdate()]
]
discount_amount = frappe.db.get_value('GL Entry', {'account': discount_account, 'voucher_no': si.name}, 'debit')
self.assertEqual(discount_amount, 100)
check_gl_entries(self, si.name, expected_gle, nowdate())
def get_sales_invoice_for_e_invoice():
si = make_sales_invoice_for_ewaybill()