Reuse opening balance Tally master flow for cash ledger selection
This commit is contained in:
@@ -252,7 +252,7 @@ def cash_payment_review(
|
||||
|
||||
@router.post("/ledgers")
|
||||
async def cash_payment_ledgers(request: Request):
|
||||
"""Load Cash-in-Hand ledgers directly; keep full-ledger sync only as manual fallback."""
|
||||
"""Load Cash ledgers using the same live Tally master snapshot path as Opening Balance Review."""
|
||||
form = await request.form()
|
||||
validate_csrf(request, str(form.get("csrf_token") or ""))
|
||||
db = CommonSessionLocal()
|
||||
@@ -287,23 +287,19 @@ async def cash_payment_ledgers(request: Request):
|
||||
"tally_guid": tally_guid,
|
||||
"company_name": company_name,
|
||||
}
|
||||
if ledger_scope == "all":
|
||||
# Explicit manual fallback preserves the existing full-master async flow.
|
||||
payload["force_refresh"] = force_refresh
|
||||
result = request_agent_command(
|
||||
node.node_code,
|
||||
"accounting_cash_payment_ledgers_start",
|
||||
payload,
|
||||
timeout_seconds=20,
|
||||
)
|
||||
else:
|
||||
# Normal path: small filtered Tally collection, no full ledger cache.
|
||||
result = request_agent_command(
|
||||
node.node_code,
|
||||
"accounting_cash_payment_cash_ledgers",
|
||||
payload,
|
||||
timeout_seconds=30,
|
||||
)
|
||||
# Use the same proven live Tally master-snapshot mechanism used by
|
||||
# Opening Balance Review. The Local Agent resolves the selected open
|
||||
# company, reads the standard Tally masters and returns either only
|
||||
# Cash-in-Hand ledgers or all ledgers for explicit manual selection.
|
||||
# No separate cash-ledger cache/job is required for this selector.
|
||||
payload["ledger_scope"] = ledger_scope
|
||||
payload["force_refresh"] = force_refresh
|
||||
result = request_agent_command(
|
||||
node.node_code,
|
||||
"accounting_cash_payment_cash_ledgers",
|
||||
payload,
|
||||
timeout_seconds=180,
|
||||
)
|
||||
except Exception as exc:
|
||||
return JSONResponse({"ok": False, "error": str(exc)}, status_code=502)
|
||||
if not result.get("ok"):
|
||||
|
||||
Reference in New Issue
Block a user