Skip to content

Commit

Permalink
fix: optimise function update_gst_category
Browse files Browse the repository at this point in the history
  • Loading branch information
ljain112 committed Jul 11, 2024
1 parent 39378f3 commit fec5bf2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions india_compliance/gst_india/doctype/gst_settings/gst_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,21 @@ def update_gst_category():

# party-wise addresses
category_map = {}
gstin_wise_detail = {}

for address in address_without_category:
gstin_info = get_gstin_info(address.gstin)
gst_category = gstin_info.gst_category
gstin = address.gstin

if gstin not in gstin_wise_detail:
gstin_info = get_gstin_info(gstin)
gstin_wise_detail[gstin] = gstin_info

gstin_info = gstin_wise_detail[gstin]

if not gstin_info:
continue

gst_category = gstin_wise_detail[gstin].get("gst_category")

category_map.setdefault(gst_category, []).append(address.name)

Expand Down

0 comments on commit fec5bf2

Please sign in to comment.