Skip to content

Commit

Permalink
fix: only download sections with records
Browse files Browse the repository at this point in the history
(cherry picked from commit a197267)
  • Loading branch information
vorasmit authored and mergify[bot] committed Jan 10, 2025
1 parent abf6f02 commit 924046e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion india_compliance/gst_india/utils/gstr_1/gstr_1_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from india_compliance.gst_india.doctype.gstr_import_log.gstr_import_log import (
create_import_log,
)
from india_compliance.gst_india.utils.gstr_1 import GovJsonKey
from india_compliance.gst_india.utils.gstr_1.gstr_1_json_map import (
convert_to_internal_data_format,
)
Expand Down Expand Up @@ -122,4 +123,33 @@ def save_gstr_1_unfiled_data(gstin, return_period, json_data):


def get_sections_to_download(summary):
return ACTIONS
if summary.isnil:
return []

SECTION_ACTION_MAP = {
"B2B": "B2B",
"B2CL": "B2CL",
"B2CS": "B2CS",
"CDNR": "CDNR",
"CDNUR": "CDNUR",
"EXP": "EXP",
"NIL": "NIL",
"AT": "AT",
"TXPD": "TXP",
"HSN": "HSNSUM",
"DOC_ISSUE": "DOCISS",
}

actions = set()

for row in summary.get(GovJsonKey.RET_SUM.value):
section = row.get("sec_nm")

# total no of records
if row.get("ttl_rec") == 0:
continue

if section in SECTION_ACTION_MAP:
actions.add(SECTION_ACTION_MAP[section])

return list(actions)

0 comments on commit 924046e

Please sign in to comment.