Skip to content

Commit

Permalink
fix: handle irn generated in other portal error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Jan 2, 2025
1 parent cdd0d2b commit bf9eadf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions india_compliance/gst_india/api_classes/e_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class EInvoiceAPI(BaseAPI):
# Cancel IRN errors
"9999": "Invoice is not active",
"4002": "EwayBill is already generated for this IRN",
# IRN Generated in different Portal
"2148": "Requested IRN data is not available",
# Invalid GSTIN error
"3028": "GSTIN is invalid",
"3029": "GSTIN is not active",
Expand Down
5 changes: 5 additions & 0 deletions india_compliance/gst_india/utils/e_waybill.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ def _generate_e_waybill(doc, throw=True, force=False):
if result.error_code == "4002":
result = api(doc).get_e_waybill_by_irn(doc.get("irn"))

if result.error_code == "2148":
with_irn = False
data = EWaybillData(doc).get_data(with_irn=with_irn)
result = EWaybillAPI(doc).generate_e_waybill(data)

except GSPServerError as e:
handle_server_errors(settings, doc, "e-Waybill", e)
return
Expand Down

0 comments on commit bf9eadf

Please sign in to comment.