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.
This commit is contained in:
Nabin Hait
2026-06-09 16:52:50 +05:30
parent 6a7c9f616e
commit ddbd61b2a2
4 changed files with 4 additions and 6 deletions

View File

@@ -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

View File

@@ -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.<fn> -- 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,
)

View File

@@ -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)

View File

@@ -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,