From 5cfe43445021fcaeb00a5876c6e120fb6efc41f3 Mon Sep 17 00:00:00 2001 From: Ninad1306 Date: Thu, 5 Dec 2024 19:00:16 +0530 Subject: [PATCH] fix: common constant --- india_compliance/gst_india/constants/__init__.py | 8 ++++++++ .../gst_invoice_management_system.js | 2 +- .../gst_invoice_management_system.py | 4 ++-- india_compliance/gst_india/utils/gstr_2/gstr.py | 7 ------- india_compliance/gst_india/utils/gstr_2/gstr_2a.py | 5 ++--- india_compliance/gst_india/utils/gstr_2/gstr_2b.py | 7 +++---- india_compliance/gst_india/utils/gstr_2/ims.py | 11 ++--------- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/india_compliance/gst_india/constants/__init__.py b/india_compliance/gst_india/constants/__init__.py index 39f0996658..7abca23de1 100644 --- a/india_compliance/gst_india/constants/__init__.py +++ b/india_compliance/gst_india/constants/__init__.py @@ -36,6 +36,14 @@ "Input Service Distributor": "B2B", } +GST_CATEGORY_MAP = { + "R": "Regular", + "SEZWP": "SEZ supplies with payment of tax", + "SEZWOP": "SEZ supplies with out payment of tax", + "DE": "Deemed exports", + "CBW": "Intra-State Supplies attracting IGST", +} + EXPORT_TYPES = ( "WOP", # Without Payment of Tax [0] "WP", # With Payment of Tax [1] diff --git a/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.js b/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.js index b70346e48f..09efb0d792 100644 --- a/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.js +++ b/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.js @@ -42,7 +42,7 @@ frappe.ui.form.on("GST Invoice Management System", { if (!frm.doc.is_data_loaded) { frm.page.clear_primary_action(); - frm.page.set_primary_action(__("Generate"), async () => { + frm.page.set_primary_action(__("Show Invoices"), async () => { const { message } = await frm.call("get_invoice_data"); frm.doc.__invoice_data = message; diff --git a/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.py b/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.py index 1f2fa50c81..2dfcea512f 100644 --- a/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.py +++ b/india_compliance/gst_india/doctype/gst_invoice_management_system/gst_invoice_management_system.py @@ -26,7 +26,7 @@ ) from india_compliance.gst_india.utils import parse_datetime from india_compliance.gst_india.utils.gstr_2 import download_ims_invoices, ims -from india_compliance.gst_india.utils.gstr_2.ims import ACTION_MAP, GST_CATEGORY +from india_compliance.gst_india.utils.gstr_2.ims import ACTION_MAP, GST_CATEGORY_MAP class GSTInvoiceManagementSystem(Document): @@ -257,7 +257,7 @@ def convert_data_to_gov_format(gst_inward_supply_list, company_gstin, is_reset=F "Credit Note_1": "b2bcna", } - gst_category_map = {v: k for k, v in GST_CATEGORY.items()} + gst_category_map = {v: k for k, v in GST_CATEGORY_MAP.items()} action_map = {v: k for k, v in ACTION_MAP.items()} upload_data = {} diff --git a/india_compliance/gst_india/utils/gstr_2/gstr.py b/india_compliance/gst_india/utils/gstr_2/gstr.py index 890285f761..02b15f64e0 100644 --- a/india_compliance/gst_india/utils/gstr_2/gstr.py +++ b/india_compliance/gst_india/utils/gstr_2/gstr.py @@ -19,13 +19,6 @@ class GSTR: { "Y_N_to_check": {"Y": 1, "N": 0}, "yes_no": {"Y": "Yes", "N": "No"}, - "gst_category": { - "R": "Regular", - "SEZWP": "SEZ supplies with payment of tax", - "SEZWOP": "SEZ supplies with out payment of tax", - "DE": "Deemed exports", - "CBW": "Intra-State Supplies attracting IGST", - }, "states": {value: f"{value}-{key}" for key, value in STATE_NUMBERS.items()}, "note_type": {"C": "Credit Note", "D": "Debit Note"}, "isd_type_2a": {"ISDCN": "ISD Credit Note", "ISD": "ISD Invoice"}, diff --git a/india_compliance/gst_india/utils/gstr_2/gstr_2a.py b/india_compliance/gst_india/utils/gstr_2/gstr_2a.py index 7459f2da16..e4ab1e4da9 100644 --- a/india_compliance/gst_india/utils/gstr_2/gstr_2a.py +++ b/india_compliance/gst_india/utils/gstr_2/gstr_2a.py @@ -2,6 +2,7 @@ import frappe +from india_compliance.gst_india.constants import GST_CATEGORY_MAP from india_compliance.gst_india.utils import get_datetime, parse_datetime from india_compliance.gst_india.utils.gstr_2.gstr import GSTR, get_mapped_value @@ -129,9 +130,7 @@ def setup(self): def get_invoice_details(self, invoice): return { "bill_no": invoice.inum, - "supply_type": get_mapped_value( - invoice.inv_typ, self.VALUE_MAPS.gst_category - ), + "supply_type": get_mapped_value(invoice.inv_typ, GST_CATEGORY_MAP), "bill_date": parse_datetime(invoice.idt, day_first=True), "document_value": invoice.val, "place_of_supply": get_mapped_value(invoice.pos, self.VALUE_MAPS.states), diff --git a/india_compliance/gst_india/utils/gstr_2/gstr_2b.py b/india_compliance/gst_india/utils/gstr_2/gstr_2b.py index b062cabc9d..f451660ef9 100644 --- a/india_compliance/gst_india/utils/gstr_2/gstr_2b.py +++ b/india_compliance/gst_india/utils/gstr_2/gstr_2b.py @@ -1,5 +1,6 @@ import frappe +from india_compliance.gst_india.constants import GST_CATEGORY_MAP from india_compliance.gst_india.utils import parse_datetime from india_compliance.gst_india.utils.gstr_2.gstr import GSTR, get_mapped_value @@ -40,7 +41,7 @@ def setup(self): def get_invoice_details(self, invoice): return { "bill_no": invoice.inum, - "supply_type": get_mapped_value(invoice.typ, self.VALUE_MAPS.gst_category), + "supply_type": get_mapped_value(invoice.typ, GST_CATEGORY_MAP), "bill_date": parse_datetime(invoice.dt, day_first=True), "taxable_value": invoice.txval, "igst": invoice.igst, @@ -98,9 +99,7 @@ def get_invoice_details(self, invoice): { "bill_no": invoice.ntnum, "doc_type": get_mapped_value(invoice.typ, self.VALUE_MAPS.note_type), - "supply_type": get_mapped_value( - invoice.suptyp, self.VALUE_MAPS.gst_category - ), + "supply_type": get_mapped_value(invoice.suptyp, GST_CATEGORY_MAP), } ) return invoice_details diff --git a/india_compliance/gst_india/utils/gstr_2/ims.py b/india_compliance/gst_india/utils/gstr_2/ims.py index 1b2c51676c..36bb1f7089 100644 --- a/india_compliance/gst_india/utils/gstr_2/ims.py +++ b/india_compliance/gst_india/utils/gstr_2/ims.py @@ -1,7 +1,7 @@ import frappe from frappe.utils.data import format_date -from india_compliance.gst_india.constants import STATE_NUMBERS +from india_compliance.gst_india.constants import GST_CATEGORY_MAP, STATE_NUMBERS from india_compliance.gst_india.doctype.gst_inward_supply.gst_inward_supply import ( create_inward_supply, update_previous_ims_action, @@ -9,13 +9,6 @@ from india_compliance.gst_india.utils import parse_datetime ACTION_MAP = {"A": "Accepted", "R": "Rejected", "P": "Pending", "N": "No Action"} -GST_CATEGORY = { - "R": "Regular", - "SEZWP": "SEZ supplies with payment of tax", - "SEZWOP": "SEZ supplies with out payment of tax", - "DE": "Deemed exports", - "CBW": "Intra-State Supplies attracting IGST", -} class IMS: @@ -64,7 +57,7 @@ def update_transaction(self, invoice): return { "supplier_gstin": invoice.stin, "sup_return_period": invoice.rtnprd, - "supply_type": GST_CATEGORY[invoice.inv_typ], + "supply_type": GST_CATEGORY_MAP[invoice.inv_typ], "place_of_supply": self.STATE_MAP[invoice.pos], "document_value": invoice.val, "company": self.company,