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 5fae5f1
Show file tree
Hide file tree
Showing 2 changed files with 15 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 @@ -240,6 +240,9 @@ def _update_gstr_1_filed_upto(filing_date):
getdate(f"{info['ret_prd'][2:]}-{info['ret_prd'][0:2]}-01")
)

# is freq available in filing details ?
# if not, then fetch filing freq

if key in gstr1_logs:
if gstr1_logs[key] != info["arn"]:
frappe.db.set_value(DOCTYPE, key, filing_details)
Expand All @@ -260,6 +263,16 @@ def _update_gstr_1_filed_upto(filing_date):
_update_gstr_1_filed_upto(filed_upto)


def get_filing_frequency(gstin, period):
# is not Q1-M1 ? => fetch if available from Q1-M1
# if not, is it filed for the period ? => if not, then don't fetch and return nothing

# if filed, then fetch from the filed data

# cache the request for 2 minutes
pass


def get_gst_return_log(posting_date, company_gstin):
period = getdate(posting_date).strftime("%m%Y")
if name := frappe.db.exists(DOCTYPE, f"GSTR1-{period}-{company_gstin}"):
Expand Down

0 comments on commit 5fae5f1

Please sign in to comment.