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:
Maharshi Patel
2022-07-14 15:12:51 +05:30
parent 28e4e4320e
commit 82539fc18a
3 changed files with 13 additions and 12 deletions

View File

@@ -40,13 +40,12 @@ def validate_gstin_for_india(doc, method):
gst_category = []
if hasattr(doc, "gst_category"):
if len(doc.links):
link_doctype = doc.links[0].get("link_doctype")
link_name = doc.links[0].get("link_name")
if len(doc.links):
link_doctype = doc.links[0].get("link_doctype")
link_name = doc.links[0].get("link_name")
if link_doctype in ["Customer", "Supplier"]:
gst_category = frappe.db.get_value(link_doctype, {"name": link_name}, ["gst_category"])
if link_doctype in ["Customer", "Supplier"]:
gst_category = frappe.db.get_value(link_doctype, {"name": link_name}, ["gst_category"])
doc.gstin = doc.gstin.upper().strip()
if not doc.gstin or doc.gstin == "NA":