Skip to content

Commit

Permalink
fix: cache filing preference and add function outline
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit committed Nov 4, 2024
1 parent eaef956 commit b4625d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion india_compliance/gst_india/api_classes/taxpayer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions india_compliance/gst_india/utils/gstin_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b4625d6

Please sign in to comment.