Restore local accounting active mapping compatibility

This commit is contained in:
A R R R Associates
2026-09-07 14:43:33 +05:30
parent 532ddf736b
commit 41d4a7b647
3 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import io
from pathlib import Path
import zipfile
ERP_LOCAL_AGENT_VERSION = "1.26.1"
ERP_LOCAL_AGENT_VERSION = "1.26.2"
ERP_LOCAL_AGENT_NAME = "ERP Local Agent"
RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime"
_DETERMINISTIC_ZIP_TIMESTAMP = (2026, 1, 1, 0, 0, 0)
@@ -1,2 +1,2 @@
__version__ = "1.26.1"
__version__ = "1.26.2"
AGENT_NAME = "ERP Local Agent"
@@ -597,6 +597,27 @@ class LocalAccountingStore:
raise ValueError("The selected open Tally company is not mapped to this ERP client. Complete Phase 2 mapping first.")
return dict(row)
def list_active_mappings(self, client_id: int) -> list[dict]:
"""Return all active Tally mappings for the client.
Existing command handlers use this when the mirror already identifies the
company but a GUID-specific lookup is unavailable or when a posting tool
needs to resolve the client's sole active mapping. Keeping this operation
in LocalAccountingStore makes Depreciation and Cash Payment Allocation use
the same mapping table as the existing Tally mapping workflow.
"""
if not self.exists(client_id):
return []
with self.connect(client_id) as db:
rows = db.execute(
"""SELECT *
FROM tally_company_mapping
WHERE client_id=? AND is_active=1
ORDER BY id DESC""",
(int(client_id),),
).fetchall()
return [dict(row) for row in rows]
def unmap_company(self, client_id: int, mapping_id: int, unmapped_by_user_id: int | None = None) -> dict:
if not self.exists(client_id):
raise ValueError("Accounting storage is not initialized for this client.")