Unify accounting analysis on Client FY mirror registry

This commit is contained in:
A R R R Associates
2026-09-20 16:36:14 +05:30
parent 24b13e5d6e
commit c63fc2773c
11 changed files with 103 additions and 45 deletions
@@ -936,7 +936,7 @@ def register_accounting_mirror_version(
is_active=True,
status="active",
accounting_relative_dir=str(accounting_relative_dir or "").strip(),
mirror_file_name=Path(str(job.get("accounting_db_path") or f"client_{int(client_id):08d}.act")).name,
mirror_file_name=Path(str(job.get("mirror_db_path") or mirror.get("path") or job.get("accounting_db_path") or f"client_{int(client_id):08d}_mirror.act")).name,
created_by_user_id=requested_by_user_id,
supersedes_mirror_id=(int(current.id) if current else None),
)
@@ -969,8 +969,8 @@ def register_accounting_mirror_version(
row.storage_node_id = int(storage_node_id) if storage_node_id else None
row.accounting_relative_dir = str(accounting_relative_dir or row.accounting_relative_dir or "").strip()
row.mirror_file_name = Path(str(job.get("accounting_db_path") or row.mirror_file_name or f"client_{int(client_id):08d}.act")).name
mirror_local_path = str(job.get("accounting_db_path") or mirror.get("path") or "").strip()
row.mirror_file_name = Path(str(job.get("mirror_db_path") or mirror.get("path") or job.get("accounting_db_path") or row.mirror_file_name or f"client_{int(client_id):08d}_mirror.act")).name
mirror_local_path = str(job.get("mirror_db_path") or mirror.get("path") or job.get("accounting_db_path") or "").strip()
if mirror_local_path:
row.mirror_local_path = mirror_local_path
tally_relative = str(job.get("tally_data_relative_path") or mirror.get("tally_data_relative_path") or "").strip()
@@ -1040,7 +1040,7 @@ def upsert_registered_mirror(
current.company_name = str(((mirror or {}).get("company") or {}).get("company_name") or current.company_name or "").strip()
current.company_guid = str(((mirror or {}).get("company") or {}).get("company_guid") or current.company_guid or "").strip()
current.file_size_bytes = int((mirror or {}).get("size_bytes") or current.file_size_bytes or 0)
discovered_path = str((job or {}).get("accounting_db_path") or (mirror or {}).get("path") or "").strip()
discovered_path = str((job or {}).get("mirror_db_path") or (mirror or {}).get("path") or (job or {}).get("accounting_db_path") or "").strip()
if discovered_path:
current.mirror_local_path = discovered_path
current.updated_at_utc = _mirror_utcnow()