diff --git a/erpnext/stock/services/ledger_preview.py b/erpnext/controllers/ledger_preview.py similarity index 87% rename from erpnext/stock/services/ledger_preview.py rename to erpnext/controllers/ledger_preview.py index cdb8209da2f..ce074903aaf 100644 --- a/erpnext/stock/services/ledger_preview.py +++ b/erpnext/controllers/ledger_preview.py @@ -1,13 +1,14 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -"""Read-side GL / Stock Ledger preview helpers for stock transactions. +"""Read-side GL / Stock Ledger preview helpers. -A dry-run consumer of the posting path: it submits-in-memory, reads the resulting -GL/SLE entries and formats them for the datatable preview, then the caller rolls -back. Lives separately from the posting services it orchestrates. The whitelisted -``show_*_preview`` entry points stay on ``stock_controller`` (their dotted path is -referenced from client JS). +A dry-run consumer of the posting path, shared across accounts and stock vouchers +(Sales/Purchase Invoice, Payment Entry, Delivery Note, Purchase Receipt, Stock +Entry): it submits-in-memory, reads the resulting GL/SLE entries and formats them +for the datatable preview, then rolls back. Lives separately from the posting +services it orchestrates. The whitelisted ``show_*_preview`` entry points stay on +``stock_controller`` (their dotted path is referenced from client JS). """ import frappe diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 77ee04d3390..9fd61d6a209 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -563,7 +563,7 @@ class StockController(AccountsController): @frappe.whitelist() def show_accounting_ledger_preview(company: str, doctype: str, docname: str): - from erpnext.stock.services.ledger_preview import get_accounting_ledger_preview + from erpnext.controllers.ledger_preview import get_accounting_ledger_preview filters = frappe._dict(company=company, include_dimensions=1) doc = frappe.get_lazy_doc(doctype, docname) @@ -578,7 +578,7 @@ def show_accounting_ledger_preview(company: str, doctype: str, docname: str): @frappe.whitelist() def show_stock_ledger_preview(company: str, doctype: str, docname: str): - from erpnext.stock.services.ledger_preview import get_stock_ledger_preview + from erpnext.controllers.ledger_preview import get_stock_ledger_preview filters = frappe._dict(company=company) doc = frappe.get_lazy_doc(doctype, docname)