Restore local accounting active mapping compatibility
This commit is contained in:
@@ -4,7 +4,7 @@ import io
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
ERP_LOCAL_AGENT_VERSION = "1.26.1"
|
ERP_LOCAL_AGENT_VERSION = "1.26.2"
|
||||||
ERP_LOCAL_AGENT_NAME = "ERP Local Agent"
|
ERP_LOCAL_AGENT_NAME = "ERP Local Agent"
|
||||||
RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime"
|
RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime"
|
||||||
_DETERMINISTIC_ZIP_TIMESTAMP = (2026, 1, 1, 0, 0, 0)
|
_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"
|
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.")
|
raise ValueError("The selected open Tally company is not mapped to this ERP client. Complete Phase 2 mapping first.")
|
||||||
return dict(row)
|
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:
|
def unmap_company(self, client_id: int, mapping_id: int, unmapped_by_user_id: int | None = None) -> dict:
|
||||||
if not self.exists(client_id):
|
if not self.exists(client_id):
|
||||||
raise ValueError("Accounting storage is not initialized for this client.")
|
raise ValueError("Accounting storage is not initialized for this client.")
|
||||||
|
|||||||
Reference in New Issue
Block a user