Restore local accounting active mapping compatibility
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user