diff --git a/india_compliance/gst_india/api_classes/taxpayer_returns.py b/india_compliance/gst_india/api_classes/taxpayer_returns.py index 5cf7369959..268fae30d3 100644 --- a/india_compliance/gst_india/api_classes/taxpayer_returns.py +++ b/india_compliance/gst_india/api_classes/taxpayer_returns.py @@ -1,3 +1,6 @@ +import frappe +from frappe import _ + from india_compliance.gst_india.api_classes.taxpayer_base import TaxpayerBaseAPI @@ -58,6 +61,19 @@ def get_data(self, action, return_period, otp=None): class GSTR1API(ReturnsAPI): API_NAME = "GSTR-1" + def setup(self, doc=None, *, company_gstin=None): + if doc: + company_gstin = doc.gstin + self.default_log_values.update( + reference_doctype=doc.doctype, + reference_name=doc.name, + ) + + if not company_gstin: + frappe.throw(_("Company GSTIN is required to use the GSTR-1 API")) + + super().setup(company_gstin=company_gstin) + def get_gstr_1_data(self, action, return_period, otp=None): return self.get( action=action, diff --git a/india_compliance/gst_india/doctype/gst_return_log/gst_return_log.json b/india_compliance/gst_india/doctype/gst_return_log/gst_return_log.json index 2a179baa48..78857c16f5 100644 --- a/india_compliance/gst_india/doctype/gst_return_log/gst_return_log.json +++ b/india_compliance/gst_india/doctype/gst_return_log/gst_return_log.json @@ -191,8 +191,13 @@ ], "in_create": 1, "index_web_pages_for_search": 1, - "links": [], - "modified": "2024-07-14 18:35:34.743195", + "links": [ + { + "link_doctype": "Integration Request", + "link_fieldname": "reference_docname" + } + ], + "modified": "2024-08-14 17:53:03.509293", "modified_by": "Administrator", "module": "GST India", "name": "GST Return Log", diff --git a/india_compliance/gst_india/utils/gstr_1/gstr_1_download.py b/india_compliance/gst_india/utils/gstr_1/gstr_1_download.py index eb39ba59f9..29ff0c7543 100644 --- a/india_compliance/gst_india/utils/gstr_1/gstr_1_download.py +++ b/india_compliance/gst_india/utils/gstr_1/gstr_1_download.py @@ -37,7 +37,7 @@ def download_gstr1_json_data(gstr1_log): is_queued = False json_data = frappe._dict() - api = GSTR1API(gstin) + api = GSTR1API(gstr1_log) if gstr1_log.filing_status == "Filed": return_type = "GSTR1"