Integrate read-only accounting mirror analytics runtime
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from app.modules.accounting.accounting_mirror_service import (
|
||||
cash_transactions,
|
||||
daybook,
|
||||
gst_history,
|
||||
hsn_history,
|
||||
inventory,
|
||||
ledger_transactions,
|
||||
mirror_exceptions,
|
||||
mirror_query,
|
||||
mirror_status,
|
||||
stock_items,
|
||||
trial_balance,
|
||||
voucher,
|
||||
)
|
||||
|
||||
|
||||
class AccountingAnalyticsDataSource:
|
||||
"""Common read-only data source for accounting/audit analytical procedures.
|
||||
|
||||
This class is additive. Existing tools are not silently redirected in v1.23.0.
|
||||
New or migrated tools can use the mirror immediately while current Opening
|
||||
Balance, Cash Payment, Depreciation and posting workflows continue unchanged.
|
||||
"""
|
||||
|
||||
def __init__(self, *, node_code: str, accounting_payload: dict[str, Any]):
|
||||
self.node_code = str(node_code or "").strip()
|
||||
self.accounting_payload = dict(accounting_payload or {})
|
||||
if not self.node_code:
|
||||
raise ValueError("node_code is required.")
|
||||
|
||||
def status(self):
|
||||
return mirror_status(node_code=self.node_code, accounting_payload=self.accounting_payload)
|
||||
|
||||
def daybook(self, **kwargs):
|
||||
return daybook(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def trial_balance(self, **kwargs):
|
||||
return trial_balance(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def ledger_transactions(self, **kwargs):
|
||||
return ledger_transactions(
|
||||
node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs
|
||||
)
|
||||
|
||||
def inventory(self, **kwargs):
|
||||
return inventory(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def stock_items(self, **kwargs):
|
||||
return stock_items(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def hsn_history(self, **kwargs):
|
||||
return hsn_history(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def gst_history(self, **kwargs):
|
||||
return gst_history(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def cash_transactions(self, **kwargs):
|
||||
return cash_transactions(
|
||||
node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs
|
||||
)
|
||||
|
||||
def voucher(self, **kwargs):
|
||||
return voucher(node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs)
|
||||
|
||||
def exceptions(self, **kwargs):
|
||||
return mirror_exceptions(
|
||||
node_code=self.node_code, accounting_payload=self.accounting_payload, **kwargs
|
||||
)
|
||||
|
||||
def raw(self, query: str, filters: dict[str, Any] | None = None):
|
||||
return mirror_query(
|
||||
node_code=self.node_code,
|
||||
accounting_payload=self.accounting_payload,
|
||||
query=query,
|
||||
filters=filters or {},
|
||||
)
|
||||
Reference in New Issue
Block a user