From 5e657ec68f0b3ba3a2d2ccaabb78ef6648bc3384 Mon Sep 17 00:00:00 2001 From: ljain112 Date: Wed, 4 Sep 2024 12:07:55 +0530 Subject: [PATCH] fix: use `get_gstin_list` function for fetching list of gstins in GSTR1 Report --- .../gst_india/report/gstr_1/gstr_1.py | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/india_compliance/gst_india/report/gstr_1/gstr_1.py b/india_compliance/gst_india/report/gstr_1/gstr_1.py index df029d5b9..769a8df8f 100644 --- a/india_compliance/gst_india/report/gstr_1/gstr_1.py +++ b/india_compliance/gst_india/report/gstr_1/gstr_1.py @@ -22,7 +22,11 @@ get_hsn_data, get_hsn_wise_json_data, ) -from india_compliance.gst_india.utils import get_escaped_name, get_gst_accounts_by_type +from india_compliance.gst_india.utils import ( + get_escaped_name, + get_gst_accounts_by_type, + get_gstin_list, +) from india_compliance.gst_india.utils.exporter import ExcelExporter from india_compliance.gst_india.utils.gstr_1 import SUPECOM @@ -2199,19 +2203,7 @@ def get_company_gstin_number(company, address=None, all_gstins=False): gstin = frappe.db.get_value("Address", address, "gstin") if not gstin: - filters = [ - ["is_your_company_address", "=", 1], - ["Dynamic Link", "link_doctype", "=", "Company"], - ["Dynamic Link", "link_name", "=", company], - ["Dynamic Link", "parenttype", "=", "Address"], - ["gstin", "!=", ""], - ] - gstin = frappe.get_all( - "Address", - filters=filters, - pluck="gstin", - order_by="is_primary_address desc", - ) + gstin = get_gstin_list(company) if gstin and not all_gstins: gstin = gstin[0]