Fix Tally GST registration discovery via Tax Unit masters

This commit is contained in:
A R R R Associates
2026-08-20 22:58:06 +05:30
parent fa0f681106
commit 92f06f333a
6 changed files with 120 additions and 15 deletions
+11 -6
View File
@@ -144,15 +144,20 @@ def _enrich_gstin_display(live_result: dict | None, registrations) -> None:
erp_gstins = []
live_company = company_by_guid.get(str(mapping.get("tally_guid") or "").strip()) or {}
tally_gstin = _normalise_gstin(live_company.get("gstin") or mapping.get("gstin"))
tally_gstins: list[str] = []
for value in list(live_company.get("gstins") or []) + [live_company.get("gstin"), mapping.get("gstin")]:
gstin = _normalise_gstin(value)
if gstin and gstin not in tally_gstins:
tally_gstins.append(gstin)
mapping["erp_gstins"] = erp_gstins
mapping["tally_gstin_display"] = tally_gstin
mapping["tally_gstins"] = tally_gstins
mapping["tally_gstin_display"] = ", ".join(tally_gstins)
if erp_gstins and tally_gstin:
mapping["gstin_match_status"] = "matched" if tally_gstin in erp_gstins else "mismatch"
elif erp_gstins and not tally_gstin:
if erp_gstins and tally_gstins:
mapping["gstin_match_status"] = "matched" if set(erp_gstins).intersection(tally_gstins) else "mismatch"
elif erp_gstins and not tally_gstins:
mapping["gstin_match_status"] = "tally_missing"
elif tally_gstin and not erp_gstins:
elif tally_gstins and not erp_gstins:
mapping["gstin_match_status"] = "erp_missing"
else:
mapping["gstin_match_status"] = "unavailable"