Skip to content

Commit

Permalink
fix: changes as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed May 21, 2024
1 parent dafce77 commit b7053e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
8 changes: 6 additions & 2 deletions india_compliance/gst_india/utils/gstr_2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def download_gstr_2a(gstin, return_periods, otp=None, gst_categories=None):
return response

if response.error_type == "not_generated":
frappe.msgprint("No data has found for {0}".format(return_period))
frappe.msgprint(
"Either you do not have any records in GSTR-2B or the generation is still in progress."
)
continue

if response.error_type == "no_docs_found":
Expand Down Expand Up @@ -155,7 +157,9 @@ def download_gstr_2b(gstin, return_periods, otp=None):
return response

if response.error_type == "not_generated":
frappe.msgprint("No data has found for {0}".format(return_period))
frappe.msgprint(
"Either you do not have any records in GSTR-2B or the generation is still in progress."
)
continue

if response.error_type == "no_docs_found":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@


def execute():
requests = frappe.get_list(
requests = frappe.get_all(
"Integration Request",
filters={"url": ("like", "%gstr2b%"), "data": ("!=", ""), "output": ("!=", "")},
filters={
"url": ("like", "%gstr2b%"),
"data": ("!=", ""),
"output": ("like", "%RET2B1023%"),
},
fields=["data", "output"],
)

for request in requests:
request_data = json.loads(request.data)
response = json.loads(request.output)

error = response.get("error", {})
if error.get("error_cd", "") == "RET2B1023":
frappe.db.delete(
"GSTR Import Log",
filters={
"data_not_found": 1,
"gstin": request_data.get("gstin", ""),
"return_period": request_data.get("rtnprd", ""),
},
)
frappe.db.delete(
"GSTR Import Log",
filters={
"data_not_found": 1,
"return_type": "GSTR2b",
"gstin": request_data.get("gstin", ""),
"return_period": request_data.get("rtnprd", ""),
},
)

0 comments on commit b7053e8

Please sign in to comment.