Skip to content

Commit

Permalink
fix: New GST Category Input Service Distributor Introduced (#2555)
Browse files Browse the repository at this point in the history
* fix: new gst category introduced

* fix: update usage of ISD at other places

* fix: update usage of ISD at other places

* fix: update classification for purchase reco tool

* fix: warning for users already using ISD classification

* fix: show notification conditionally

---------

Co-authored-by: Smit Vora <smitvora203@gmail.com>
Co-authored-by: Smit Vora <mailsmitvora@gmail.com>
(cherry picked from commit 6635a91)
  • Loading branch information
Ninad1306 authored and mergify[bot] committed Aug 29, 2024
1 parent 9a475b4 commit c0b41a4
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 5 deletions.
10 changes: 10 additions & 0 deletions india_compliance/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def set_bootinfo(bootinfo):

set_trigger_for_audit_trail_notification(bootinfo)
set_trigger_for_item_tax_template_notification(bootinfo)
set_trigger_for_new_gst_category_notification(bootinfo)


def set_trigger_for_audit_trail_notification(bootinfo):
Expand All @@ -49,3 +50,12 @@ def set_trigger_for_item_tax_template_notification(bootinfo):
return

bootinfo["needs_item_tax_template_notification"] = True


def set_trigger_for_new_gst_category_notification(bootinfo):
if not bootinfo.sysdefaults or not cint(
bootinfo.sysdefaults.get("needs_new_gst_category_notification", 0)
):
return

bootinfo["needs_new_gst_category_notification"] = True
2 changes: 2 additions & 0 deletions india_compliance/gst_india/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"UIN Holders": "B2B",
"Tax Deductor": "B2B",
"Tax Collector": "B2B",
"Input Service Distributor": "B2B",
}

EXPORT_TYPES = (
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"UIN Holders": UNBODY,
"Tax Deductor": TDS,
"Tax Collector": TCS,
"Input Service Distributor": REGISTERED,
}

PAN_NUMBER = re.compile(r"^[A-Z]{5}[0-9]{4}[A-Z]{1}$")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def get_all(self, additional_fields=None, names=None, only_names=False):

def get_unmatched(self, category):
gst_category = (
("Registered Regular", "Tax Deductor")
("Registered Regular", "Tax Deductor", "Input Service Distributor")
if category in ("B2B", "CDNR", "ISD")
else ("SEZ", "Overseas", "UIN Holders")
)
Expand Down Expand Up @@ -458,6 +458,7 @@ def get_fields(self, additional_fields=None, is_return=False):
"bill_no",
"place_of_supply",
"is_reverse_charge",
"itc_classification",
Abs(Sum(self.PI_ITEM.taxable_value)).as_("taxable_value"),
*tax_fields,
]
Expand Down Expand Up @@ -1233,6 +1234,7 @@ def guess_classification(doc):
"Overseas": "IMPG",
"UIN Holders": "B2B",
"Tax Deductor": "B2B",
"Input Service Distributor": "B2B",
}

classification = GST_CATEGORIES.get(doc.gst_category)
Expand All @@ -1242,6 +1244,9 @@ def guess_classification(doc):
if not classification and doc.get("doctype") == "Bill of Entry":
classification = "IMPG"

if doc.itc_classification == "Input Service Distributor":
classification = "ISD"

return classification

@staticmethod
Expand Down
2 changes: 2 additions & 0 deletions india_compliance/gst_india/report/gstr_1/gstr_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2149,6 +2149,8 @@ def get_invoice_type_for_excel(row):
"Tax Deductor": "Regular B2B",
"UIN Holders": "Regular B2B",
"Unregistered": "B2CL",
"Tax Collector": "Regular B2B",
"Input Service Distributor": "Regular B2B",
}
).get(gst_category)

Expand Down
6 changes: 6 additions & 0 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def guess_gst_category(
"Registered Composition",
"SEZ",
"Deemed Export",
"Input Service Distributor",
):
return gst_category

Expand Down Expand Up @@ -900,6 +901,11 @@ def disable_item_tax_template_notification():
frappe.defaults.clear_user_default("needs_item_tax_template_notification")


@frappe.whitelist(methods=["POST"])
def disable_new_gst_category_notification():
frappe.defaults.clear_user_default("needs_new_gst_category_notification")


def validate_invoice_number(doc):
"""Validate GST invoice number requirements."""

Expand Down
2 changes: 1 addition & 1 deletion india_compliance/gst_india/utils/gstin_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

GST_CATEGORIES = {
"Regular": "Registered Regular",
"Input Service Distributor (ISD)": "Registered Regular",
"Input Service Distributor (ISD)": "Input Service Distributor",
"Composition": "Registered Composition",
"Tax Deductor": "Tax Deductor",
"Tax Collector (Electronic Commerce Operator)": "Tax Collector",
Expand Down
5 changes: 3 additions & 2 deletions india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ india_compliance.patches.v15.remove_duplicate_web_template

[post_model_sync]
india_compliance.patches.v14.set_default_for_overridden_accounts_setting
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #55
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #56
execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #8
execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #1
india_compliance.patches.post_install.remove_old_fields #2
Expand Down Expand Up @@ -60,4 +60,5 @@ india_compliance.patches.v14.delete_not_generated_gstr_import_log
india_compliance.patches.v14.enable_sales_through_ecommerce_operator
execute:from india_compliance.gst_india.setup import set_default_print_settings; set_default_print_settings()
india_compliance.patches.v15.migrate_gstr1_log_to_returns_log
india_compliance.patches.v15.update_action_for_gst_inward_supply
india_compliance.patches.v15.update_action_for_gst_inward_supply
india_compliance.patches.v15.set_default_for_new_gst_category_notification
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import frappe
import frappe.defaults
from frappe.utils.user import get_users_with_role


def execute():
if not frappe.db.exists("Company", {"country": "India"}):
return

# Users affected by creation of new GST category
if not frappe.db.exists(
"Purchase Invoice", {"itc_classification": "Input Service Distributor"}
):
return

for user in get_users_with_role("Accounts Manager"):
frappe.defaults.set_user_default(
"needs_new_gst_category_notification", 1, user=user
)
3 changes: 2 additions & 1 deletion india_compliance/public/js/india_compliance.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "./quick_entry";
import "./transaction";
import "./audit_trail_notification";
import "./item_tax_template_notification";
import "./new_gst_category_notification";
import "./quick_info_popover";
import "./custom_number_card";
import "./taxes_controller";
import "./taxes_controller";
31 changes: 31 additions & 0 deletions india_compliance/public/js/new_gst_category_notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$(document).on("app_ready", async function () {
if (!frappe.boot.needs_new_gst_category_notification) return;

// let other processes finish
await new Promise(resolve => setTimeout(resolve, 700));
const d = frappe.msgprint({
title: __("New GST Category Introduced"),
indicator: "orange",
message: __(
`Dear India Compliance User,
<br><br>
We would like to inform you about an important update regarding the GST category for Input Service Distributors (ISD).
<br><br>
Previously, <strong>ISD was categorized under Registered Regular</strong> in our system. However, we have now introduced a dedicated GST category <strong>Input Service Distributor</strong> specifically for Input Service Distributors.
<br><br>
<strong>Action Required:</strong>
<br>
If you have been using the ISD under the <strong>Registered Regular</strong> GST category, please update your records to reflect the new <strong>Input Service Distributor</strong> category.
`
),
});

d.onhide = () => {
frappe.xcall(
"india_compliance.gst_india.utils.disable_new_gst_category_notification"
);
};
});

0 comments on commit c0b41a4

Please sign in to comment.