mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
refactor: relocate ledger_preview to controllers (cross-cutting, not stock-only)
The preview feature serves both accounts and stock vouchers (SI/PI/PE + DN/PR/SE) and its show_*_preview entry points live in controllers/stock_controller, so the cohesive GL+SLE preview module belongs in controllers/, not stock/services/. Pure move + import-path update; GL and stock previews stay together (shared get_columns/ get_data formatters; read-side, kept out of the write-path services). Verified: ledger snapshots green; module resolves at new path.
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user