mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 04:59:18 +00:00
fix: Cancellation of accounting transactions within closed accounting period (#22986)
This commit is contained in:
@@ -45,8 +45,8 @@ def validate_accounting_period(gl_map):
|
|||||||
}, as_dict=1)
|
}, as_dict=1)
|
||||||
|
|
||||||
if accounting_periods:
|
if accounting_periods:
|
||||||
frappe.throw(_("You can't create accounting entries in the closed accounting period {0}")
|
frappe.throw(_("You cannot create or cancel any accounting entries within in the closed Accounting Period {0}")
|
||||||
.format(accounting_periods[0].name), ClosedAccountingPeriod)
|
.format(frappe.bold(accounting_periods[0].name)), ClosedAccountingPeriod)
|
||||||
|
|
||||||
def process_gl_map(gl_map, merge_entries=True):
|
def process_gl_map(gl_map, merge_entries=True):
|
||||||
if merge_entries:
|
if merge_entries:
|
||||||
@@ -296,6 +296,7 @@ def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
|
|||||||
where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True)
|
where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True)
|
||||||
|
|
||||||
if gl_entries:
|
if gl_entries:
|
||||||
|
validate_accounting_period(gl_entries)
|
||||||
check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
|
check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
|
||||||
|
|
||||||
frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""",
|
frappe.db.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""",
|
||||||
|
|||||||
Reference in New Issue
Block a user