resilient-tech/india-compliance

Error in gstin info

ljain112 opened this issue ยท 2 comments

Frappe Support Issue: https://support.frappe.io/app/hd-ticket/14349

App Versions

{
    "abk_customization": "0.0.1",
    "erpnext": "15.21.2",
    "frappe": "15.25.0",
    "hrms": "15.20.1",
    "india_compliance": "15.7.3",
    "insights": "2.2.2",
    "sales_application_plugin": "0.0.1"
}

Route

List/Customer/List

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1761, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 373, in _save
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in runner
    add_to_return_value(self, f(self, method, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/overrides/party.py", line 19, in validate_party
    set_gst_category(doc)
  File "apps/india_compliance/india_compliance/gst_india/overrides/party.py", line 29, in set_gst_category
    gst_category = fetch_or_guess_gst_category(doc)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/overrides/party.py", line 49, in fetch_or_guess_gst_category
    gstin_info = _get_gstin_info(doc.gstin, throw_error=False) or {}
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/utils/gstin_info.py", line 68, in _get_gstin_info
    gstin_info.all_addresses = list(map(_get_address, all_addresses))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/utils/gstin_info.py", line 116, in _get_address
    "state": titlecase(address.get("stcd")),
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/utils/__init__.py", line 633, in titlecase
    return _titlecase(value, callback=get_titlecase_version)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/titlecase/__init__.py", line 99, in titlecase
    lines = regex.split('[\r\n]+', text)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 206, in split
    return _compile(pattern, flags).split(string, maxsplit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"name\":\"DTDC Express Limited (UP)\",\"owner\":\"arun@abkimports.com\",\"creation\":\"2023-09-27 12:37:24.941596\",\"modified\":\"2023-09-27 12:52:04.753341\",\"modified_by\":\"arun@abkimports.com\",\"docstatus\":0,\"idx\":0,\"naming_series\":\"SUP-.YYYY.-\",\"supplier_name\":\"DTDC Express Limited (UP)\",\"country\":\"India\",\"supplier_group\":\"Domestic\",\"supplier_type\":\"Company\",\"is_transporter\":0,\"default_currency\":\"INR\",\"is_internal_supplier\":0,\"represents_company\":\"\",\"language\":\"en\",\"tax_withholding_category\":\"TDS - 194C - Company\",\"gstin\":\"09AAACD8017H1ZQ\",\"pan\":\"AAACD8017H\",\"gst_category\":\"Registered Regular\",\"is_reverse_charge_applicable\":0,\"allow_purchase_invoice_creation_without_purchase_order\":1,\"allow_purchase_invoice_creation_without_purchase_receipt\":0,\"is_frozen\":0,\"disabled\":0,\"warn_rfqs\":0,\"warn_pos\":0,\"prevent_rfqs\":0,\"prevent_pos\":0,\"on_hold\":0,\"hold_type\":\"\",\"is_msme_registered\":\"No\",\"doctype\":\"Supplier\",\"companies\":[],\"accounts\":[],\"portal_users\":[],\"__onload\":{\"addr_list\":[{\"name\":\"DTDC Express Limited (UP)-Billing\",\"owner\":\"arun@abkimports.com\",\"creation\":\"2023-09-27 19:23:28.509016\",\"modified\":\"2023-09-30 13:55:04.886339\",\"modified_by\":\"nirmal@abkimports.com\",\"docstatus\":0,\"idx\":0,\"address_title\":\"DTDC Express Limited (UP)\",\"address_type\":\"Billing\",\"address_line1\":\"A-10/17,site-3, ground and first floor,, meerut road industrial area, Ghaziabad\",\"address_line2\":null,\"city\":\"Ghaziabad\",\"area\":null,\"county\":null,\"state\":\"Uttar Pradesh\",\"country\":\"India\",\"pincode\":\"226002\",\"email_id\":null,\"phone\":null,\"fax\":null,\"tax_category\":null,\"is_primary_address\":0,\"is_shipping_address\":0,\"disabled\":0,\"gstin\":\"09AAACD8017H1ZQ\",\"gst_state\":\"Uttar Pradesh\",\"gst_category\":\"Registered Regular\",\"gst_state_number\":\"09\",\"geolocation_details\":null,\"is_your_company_address\":0,\"display\":\"A-10/17,site-3, ground and first floor,, meerut road industrial area, Ghaziabad<br>Ghaziabad<br>\\nUttar Pradesh, State Code: 09<br>Pincode: 226002<br>India<br>\\nGSTIN: 09AAACD8017H1ZQ<br>\"},{\"name\":\"DTDC Express Limited (UP)-Billing-1\",\"owner\":\"arun@abkimports.com\",\"creation\":\"2023-09-27 19:43:51.158472\",\"modified\":\"2023-09-30 13:54:57.466146\",\"modified_by\":\"nirmal@abkimports.com\",\"docstatus\":0,\"idx\":0,\"address_title\":\"DTDC Express Limited (UP)\",\"address_type\":\"Billing\",\"address_line1\":\"A-10/17,site-3, ground and first floor,, meerut road industrial area, Ghaziabad\",\"address_line2\":null,\"city\":\"Ghaziabad\",\"area\":null,\"county\":null,\"state\":\"Uttar Pradesh\",\"country\":\"India\",\"pincode\":\"226002\",\"email_id\":null,\"phone\":null,\"fax\":null,\"tax_category\":null,\"is_primary_address\":0,\"is_shipping_address\":0,\"disabled\":0,\"gstin\":\"09AAACD8017H1ZQ\",\"gst_state\":\"Uttar Pradesh\",\"gst_category\":\"Registered Regular\",\"gst_state_number\":\"09\",\"geolocation_details\":null,\"is_your_company_address\":0,\"display\":\"A-10/17,site-3, ground and first floor,, meerut road industrial area, Ghaziabad<br>Ghaziabad<br>\\nUttar Pradesh, State Code: 09<br>Pincode: 226002<br>India<br>\\nGSTIN: 09AAACD8017H1ZQ<br>\"}],\"contact_list\":[],\"dashboard_info\":[{\"billing_this_year\":0,\"currency\":\"INR\",\"total_unpaid\":0,\"company\":\"ABK Imports Pvt Ltd\"}]},\"__last_sync_on\":\"2024-05-02T09:46:31.420Z\",\"__unsaved\":1,\"payment_terms\":\"NEFT - 15 days\"}",
        "action": "Save"
    },
    "btn": {
        "jQuery370073520496925448581": {
            "events": {
                "click": [
                    {
                        "type": "click",
                        "origType": "click",
                        "guid": 3116,
                        "namespace": ""
                    }
                ]
            }
        }
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs",
    "request_id": "10d7a683-8870-484c-9f82-510bfd12627d"
}

Response Data

{
    "exception": "TypeError: expected string or bytes-like object, got 'NoneType'",
    "exc_type": "TypeError",
    "_exc_source": "india_compliance (app)"
}

issue with #2041

๐ŸŽ‰ This issue has been resolved in version 14.26.5 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 15.7.4 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€