Add Phase 21 stock item master mapping intelligence

This commit is contained in:
A R R R Associates
2026-08-24 22:07:16 +05:30
parent b8fbaf55ec
commit 0fab925e71
11 changed files with 1777 additions and 10 deletions
@@ -1,2 +1,2 @@
__version__ = "1.19.0"
__version__ = "1.21.0"
AGENT_NAME = "ERP Local Agent"
@@ -38,6 +38,8 @@ class AgentCommandProcessor:
result = self._sync_masters(payload)
elif action == "accounting_chart_of_accounts":
result = self._chart_of_accounts(payload)
elif action == "accounting_stock_master_intelligence":
result = self._stock_master_intelligence(payload)
elif action == "accounting_sync_transactions":
result = self._sync_transactions(payload)
elif action == "accounting_historical_evidence":
@@ -85,7 +87,7 @@ class AgentCommandProcessor:
return {
"name": "ERP Local Agent", "version": __version__,
"tally_capability": True, "accounting_act_capability": True,
"tally_mapping_capability": True, "tally_master_sync_capability": True, "chart_of_accounts_capability": True, "native_voucher_engine_capability": True, "stock_item_native_voucher_capability": True, "bank_reconciliation_read_capability": True,
"tally_mapping_capability": True, "tally_master_sync_capability": True, "chart_of_accounts_capability": True, "native_voucher_engine_capability": True, "stock_item_native_voucher_capability": True, "stock_master_intelligence_capability": True, "bank_reconciliation_read_capability": True,
"tally_transaction_sync_capability": True,
"historical_learning_read_capability": True,
"purchase_posting_preflight_capability": True,
@@ -332,6 +334,30 @@ class AgentCommandProcessor:
def _stock_master_intelligence(self, payload: dict[str, Any]) -> dict[str, Any]:
# Read-only against Tally. Existing local .act master storage remains
# synchronized by the normal master-sync path.
sync_result = self._sync_masters(payload)
company_name = str(
(sync_result.get("sync") or {}).get("company_name")
or ""
).strip()
if not company_name:
raise ValueError("Tally company name was not resolved during master synchronization.")
masters = self.tally.fetch_accounting_masters(company_name)
return {
**sync_result,
"stock_master": {
"company_name": company_name,
"stock_groups": list(masters.get("stock_groups") or []),
"stock_items": list(masters.get("stock_items") or []),
"units": list(masters.get("units") or []),
},
"read_only": True,
}
def _chart_of_accounts(self, payload: dict[str, Any]) -> dict[str, Any]:
# Read-only: refresh the existing master snapshot, then return Groups/Ledgers.
sync_result = self._sync_masters(payload)