diff --git a/india_compliance/gst_india/api_classes/e_invoice.py b/india_compliance/gst_india/api_classes/e_invoice.py index c59b6c754..e33762301 100644 --- a/india_compliance/gst_india/api_classes/e_invoice.py +++ b/india_compliance/gst_india/api_classes/e_invoice.py @@ -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", diff --git a/india_compliance/gst_india/utils/e_waybill.py b/india_compliance/gst_india/utils/e_waybill.py index fa6e0e21e..99aed4ce7 100644 --- a/india_compliance/gst_india/utils/e_waybill.py +++ b/india_compliance/gst_india/utils/e_waybill.py @@ -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