fix: honor account freezing date when cancelling vouchers

This commit is contained in:
Shllokkk
2026-06-19 16:51:54 +05:30
parent 6cb42ab8b1
commit f4b827cb3d
2 changed files with 9 additions and 1 deletions

View File

@@ -3008,6 +3008,14 @@ class TestPurchaseInvoice(ERPNextTestSuite, StockTestMixin):
party_link.delete()
def test_purchase_invoice_cancellation_post_account_freezing_date(self):
pi = make_purchase_invoice()
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", add_days(getdate(), 1))
try:
self.assertRaises(frappe.ValidationError, pi.cancel)
finally:
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None)
def set_advance_flag(company, flag, default_account):
frappe.db.set_value(

View File

@@ -716,7 +716,7 @@ def make_reverse_gl_entries(
partial_cancel=partial_cancel,
)
validate_accounting_period(gl_entries)
check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
check_freezing_date(gl_entries[0]["posting_date"], gl_entries[0]["company"], adv_adj)
is_opening = any(d.get("is_opening") == "Yes" for d in gl_entries)