mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 23:05:12 +00:00
fix: (india) (e-invoice) allow generation for UIN Holders
e-invoice is required for UIN Holders and they should be treated as Registered Regular. there was incorrect if hasattr check that prevented UIN number validation.
This commit is contained in:
@@ -65,6 +65,7 @@ def validate_eligibility(doc):
|
|||||||
"SEZ",
|
"SEZ",
|
||||||
"Overseas",
|
"Overseas",
|
||||||
"Deemed Export",
|
"Deemed Export",
|
||||||
|
"UIN Holders",
|
||||||
]
|
]
|
||||||
company_transaction = doc.get("billing_address_gstin") == doc.get("company_gstin")
|
company_transaction = doc.get("billing_address_gstin") == doc.get("company_gstin")
|
||||||
|
|
||||||
@@ -130,9 +131,7 @@ def read_json(name):
|
|||||||
|
|
||||||
def get_transaction_details(invoice):
|
def get_transaction_details(invoice):
|
||||||
supply_type = ""
|
supply_type = ""
|
||||||
if (
|
if invoice.gst_category in ("Registered Regular", "Registered Composition", "UIN Holders"):
|
||||||
invoice.gst_category == "Registered Regular" or invoice.gst_category == "Registered Composition"
|
|
||||||
):
|
|
||||||
supply_type = "B2B"
|
supply_type = "B2B"
|
||||||
elif invoice.gst_category == "SEZ":
|
elif invoice.gst_category == "SEZ":
|
||||||
if invoice.export_type == "Without Payment of Tax":
|
if invoice.export_type == "Without Payment of Tax":
|
||||||
@@ -148,15 +147,18 @@ def get_transaction_details(invoice):
|
|||||||
supply_type = "DEXP"
|
supply_type = "DEXP"
|
||||||
|
|
||||||
if not supply_type:
|
if not supply_type:
|
||||||
rr, rc, sez, overseas, export = (
|
rr, rc, sez, overseas, export, uin = (
|
||||||
bold("Registered Regular"),
|
bold("Registered Regular"),
|
||||||
bold("Registered Composition"),
|
bold("Registered Composition"),
|
||||||
bold("SEZ"),
|
bold("SEZ"),
|
||||||
bold("Overseas"),
|
bold("Overseas"),
|
||||||
bold("Deemed Export"),
|
bold("Deemed Export"),
|
||||||
|
bold("UIN Holders"),
|
||||||
)
|
)
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("GST category should be one of {}, {}, {}, {}, {}").format(rr, rc, sez, overseas, export),
|
_("GST category should be one of {}, {}, {}, {}, {}, {}").format(
|
||||||
|
rr, rc, sez, overseas, export, uin
|
||||||
|
),
|
||||||
title=_("Invalid Supply Type"),
|
title=_("Invalid Supply Type"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -714,7 +714,7 @@ def get_custom_fields():
|
|||||||
insert_after="customer",
|
insert_after="customer",
|
||||||
no_copy=1,
|
no_copy=1,
|
||||||
print_hide=1,
|
print_hide=1,
|
||||||
depends_on='eval:in_list(["Registered Regular", "Registered Composition", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0',
|
depends_on='eval:in_list(["Registered Regular", "Registered Composition", "SEZ", "Overseas", "Deemed Export", "UIN Holders"], doc.gst_category) && doc.irn_cancelled === 0',
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
fieldname="irn_cancelled",
|
fieldname="irn_cancelled",
|
||||||
|
|||||||
@@ -40,13 +40,12 @@ def validate_gstin_for_india(doc, method):
|
|||||||
|
|
||||||
gst_category = []
|
gst_category = []
|
||||||
|
|
||||||
if hasattr(doc, "gst_category"):
|
if len(doc.links):
|
||||||
if len(doc.links):
|
link_doctype = doc.links[0].get("link_doctype")
|
||||||
link_doctype = doc.links[0].get("link_doctype")
|
link_name = doc.links[0].get("link_name")
|
||||||
link_name = doc.links[0].get("link_name")
|
|
||||||
|
|
||||||
if link_doctype in ["Customer", "Supplier"]:
|
if link_doctype in ["Customer", "Supplier"]:
|
||||||
gst_category = frappe.db.get_value(link_doctype, {"name": link_name}, ["gst_category"])
|
gst_category = frappe.db.get_value(link_doctype, {"name": link_name}, ["gst_category"])
|
||||||
|
|
||||||
doc.gstin = doc.gstin.upper().strip()
|
doc.gstin = doc.gstin.upper().strip()
|
||||||
if not doc.gstin or doc.gstin == "NA":
|
if not doc.gstin or doc.gstin == "NA":
|
||||||
|
|||||||
Reference in New Issue
Block a user