mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-16 16:08:39 +00:00
fix: honor account freezing date when cancelling vouchers
make_reverse_gl_entries passed adv_adj as the company argument to check_freezing_date, so the freeze-date check silently no-op'd on cancellation (no company matched). Pass company explicitly so cancellations respect the freezing date like submissions do. Adds a regression test covering cancellation after the freeze date.
This commit is contained in:
@@ -3493,6 +3493,14 @@ class TestSalesInvoice(ERPNextTestSuite):
|
||||
si.submit()
|
||||
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None)
|
||||
|
||||
def test_sales_invoice_cancellation_post_account_freezing_date(self):
|
||||
si = create_sales_invoice()
|
||||
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", add_days(getdate(), 1))
|
||||
try:
|
||||
self.assertRaises(frappe.ValidationError, si.cancel)
|
||||
finally:
|
||||
frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None)
|
||||
|
||||
@ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 0})
|
||||
@ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1})
|
||||
def test_over_billing_case_against_delivery_note(self):
|
||||
|
||||
@@ -640,7 +640,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user