fix: Add test for additional discount applied on taxes
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 0ac816e..3a09c96 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -268,6 +268,35 @@
check_gl_entries(self, pi.name, expected_gle, nowdate())
+ def test_additional_discount_for_purchase_invoice_with_discount_accounting_enabled(self):
+ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import check_gl_entries
+
+ enable_discount_accounting()
+ additional_discount_account = create_account(account_name="Discount Account",
+ parent_account="Indirect Expenses - _TC", company="_Test Company")
+
+ pi = make_purchase_invoice(qty=1, rate=75000, do_not_save=1)
+ pi.apply_discount_on = "Grand Total"
+ pi.additional_discount_account = additional_discount_account
+ pi.additional_discount_percentage = 10
+ pi.append("taxes", {
+ "charge_type": "On Net Total",
+ "account_head": "CGST - _TC",
+ "cost_center": "Main - _TC",
+ "description": "CGST @ 9.0",
+ "rate": 9
+ })
+ pi.submit()
+
+ expected_gle = [
+ ["Discount Account - _TC", 0.0, 675.0, nowdate()],
+ ["CGST - _TC", 6750.0, 0.0, nowdate()],
+ ["_Test Account Cost for Goods Sold - _TC", 67500.0, 0.0, nowdate()],
+ ["Creditors - _TC", 0.0, 73575.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])
pi.insert()