Fix existing GSTIN display in bulk registrations
This commit is contained in:
@@ -101,6 +101,29 @@ def bulk_registration_page(
|
||||
tenant_id = _tenant(request, user)
|
||||
branch_id = _branch(request, user)
|
||||
|
||||
gstins_by_client = {}
|
||||
gstin_rows = db.execute(
|
||||
select(
|
||||
ClientRegistration.client_id,
|
||||
ClientRegistration.registration_number,
|
||||
)
|
||||
.join(
|
||||
RegistrationType,
|
||||
RegistrationType.id == ClientRegistration.registration_type_id,
|
||||
)
|
||||
.where(
|
||||
ClientRegistration.tenant_id == tenant_id,
|
||||
RegistrationType.code == "GSTIN",
|
||||
)
|
||||
.order_by(
|
||||
ClientRegistration.client_id.asc(),
|
||||
ClientRegistration.registration_number.asc(),
|
||||
)
|
||||
).all()
|
||||
for gstin_client_id, gstin_number in gstin_rows:
|
||||
number = (gstin_number or "").strip()
|
||||
if number:
|
||||
gstins_by_client.setdefault(int(gstin_client_id), []).append(number)
|
||||
clients_query = select(Client).where(
|
||||
Client.tenant_id == tenant_id,
|
||||
Client.is_active.is_(True),
|
||||
@@ -186,6 +209,7 @@ def bulk_registration_page(
|
||||
types=types,
|
||||
rules=rules,
|
||||
consultants=consultants,
|
||||
gstins_by_client=gstins_by_client,
|
||||
created=created,
|
||||
skipped=skipped,
|
||||
invalid=invalid,
|
||||
|
||||
Reference in New Issue
Block a user