From ddbd61b2a2199bb480f4b483880315395521777f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 9 Jun 2026 16:52:50 +0530 Subject: [PATCH] refactor(journal_entry): point erpnext imports at mapper, trim re-exports Update erpnext's own importers (asset depreciation, invoice discounting and the JE tests) to import the builders from mapper.py directly. Drop make_inter_company_journal_entry and make_reverse_journal_entry from the backward-compat re-export in journal_entry.py -- they are not part of the custom-app call surface; only the payment-entry builders remain re-exported. --- .../doctype/invoice_discounting/test_invoice_discounting.py | 2 +- erpnext/accounts/doctype/journal_entry/journal_entry.py | 4 +--- erpnext/accounts/doctype/journal_entry/test_journal_entry.py | 2 +- erpnext/assets/doctype/asset/depreciation.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index 7d92fb1e117..6ab6d751412 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -5,7 +5,7 @@ import frappe from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account -from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice +from erpnext.accounts.doctype.journal_entry.mapper import get_payment_entry_against_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries from erpnext.tests.utils import ERPNextTestSuite diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 1781d41b0dd..3ddaf4af13a 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -1225,12 +1225,10 @@ def get_average_exchange_rate(account: str): return exchange_rate -# These document builders moved to mapper.py. They are re-exported here so existing +# These payment-entry builders moved to mapper.py. They are re-exported here so existing # call paths -- including custom apps that reference # erpnext.accounts.doctype.journal_entry.journal_entry. -- keep working. from erpnext.accounts.doctype.journal_entry.mapper import ( get_payment_entry_against_invoice, get_payment_entry_against_order, - make_inter_company_journal_entry, - make_reverse_journal_entry, ) diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py index b53a2ce353e..4590c5cd0b4 100644 --- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py @@ -204,7 +204,7 @@ class TestJournalEntry(ERPNextTestSuite): self.assertFalse(gle) def test_reverse_journal_entry(self): - from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry + from erpnext.accounts.doctype.journal_entry.mapper import make_reverse_journal_entry jv = make_journal_entry("_Test Bank USD - _TC", "Sales - _TC", 100, exchange_rate=50, save=False) diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index d045030ee1f..fe0710730d4 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -24,7 +24,7 @@ import erpnext from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( get_checks_for_pl_and_bs_accounts, ) -from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry +from erpnext.accounts.doctype.journal_entry.mapper import make_reverse_journal_entry from erpnext.assets.doctype.asset_activity.asset_activity import add_asset_activity from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_schedule import ( get_asset_depr_schedule_doc,