diff --git a/india_compliance/gst_india/api_classes/taxpayer_base.py b/india_compliance/gst_india/api_classes/taxpayer_base.py index e000ab4d3..253306318 100644 --- a/india_compliance/gst_india/api_classes/taxpayer_base.py +++ b/india_compliance/gst_india/api_classes/taxpayer_base.py @@ -7,7 +7,7 @@ import frappe import frappe.utils -from frappe import _ +from frappe import _, request_cache from frappe.utils import add_to_date, cint, now_datetime from india_compliance.exceptions import ( @@ -465,6 +465,7 @@ def validate_auth_token(self): return + @request_cache def get_filing_preference(self, date=None): return self.get( action="GETPREF", params={"fy": self.get_fy(date)}, endpoint="returns" diff --git a/india_compliance/gst_india/doctype/gst_return_log/generate_gstr_1.py b/india_compliance/gst_india/doctype/gst_return_log/generate_gstr_1.py index ca211f797..85744ef3e 100644 --- a/india_compliance/gst_india/doctype/gst_return_log/generate_gstr_1.py +++ b/india_compliance/gst_india/doctype/gst_return_log/generate_gstr_1.py @@ -503,6 +503,7 @@ def generate_gstr1_data(self, filters, callback=None): # APIs Enabled status = self.get_return_status() + # filing_frequency = self.get_filing_frequency() & update this in filters if status == "Filed": gov_data_field = "filed" diff --git a/india_compliance/gst_india/utils/gstin_info.py b/india_compliance/gst_india/utils/gstin_info.py index 01e02611d..855e940d9 100644 --- a/india_compliance/gst_india/utils/gstin_info.py +++ b/india_compliance/gst_india/utils/gstin_info.py @@ -335,6 +335,14 @@ def get_gstr_1_return_status( return "Not Filed" +def get_filing_frequency(gstin, period): + # is not Q1-M1 ? => fetch if available from Q1-M1 + # if not, is it filed for the period or date has surpassed? => if not, then don't fetch and return nothing + + # if filed, then fetch from the filed data + pass + + def get_fy(period, year_increment=0): month, year = period[:2], period[2:] year = str(int(year) + year_increment)