Merge pull request #49121 from rehanrehman389/je-reversal-duplicate

fix: prevent duplicate reverse Journal Entry
This commit is contained in:
ruthra kumar
2025-08-19 14:10:07 +05:30
committed by GitHub

View File

@@ -1796,6 +1796,14 @@ def make_inter_company_journal_entry(name, voucher_type, company):
@frappe.whitelist()
def make_reverse_journal_entry(source_name, target_doc=None):
existing_reverse = frappe.db.exists("Journal Entry", {"reversal_of": source_name, "docstatus": 1})
if existing_reverse:
frappe.throw(
_("A Reverse Journal Entry {0} already exists for this Journal Entry.").format(
get_link_to_form("Journal Entry", existing_reverse)
)
)
from frappe.model.mapper import get_mapped_doc
def post_process(source, target):