resilient-tech / india-compliance

Simple, yet powerful compliance solutions for Indian businesses
https://indiacompliance.app
GNU General Public License v3.0
150 stars 139 forks source link

Error while performing purchase Reconciliation for previous year #1304

Closed jpettan closed 11 months ago

jpettan commented 11 months ago

App Versions

{
    "erpnext": "14.48.0",
    "frappe": "14.55.0",
    "hrms": "14.16.1",
    "india_compliance": "14.19.3",
    "payments": "0.0.1",
    "wiki": "2.0.0"
}

Route

Form/Purchase Reconciliation Tool/Purchase Reconciliation Tool

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, 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 1622, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 31, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 309, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 343, in _save
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1055, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 919, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1281, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1263, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 916, in fn
    return method_object(*args, **kwargs)
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py", line 58, in validate
    _Reconciler.reconcile(row["original"], row["amended"])
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 751, in reconcile
    self.reconcile_for_rules(GSTIN_RULES, purchases, inward_supplies, category)
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 767, in reconcile_for_rules
    self.reconcile_for_rule(
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 811, in reconcile_for_rule
    if not self.is_doc_matching(purchase, inward_supply, rules):
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 856, in is_doc_matching
    if not self.is_field_matching(purchase, inward_supply, field.value, rule):
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 874, in is_field_matching
    return self.fuzzy_match(purchase, inward_supply)
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 889, in fuzzy_match
    purchase._bill_no = BaseUtil.get_cleaner_bill_no(
  File "apps/india_compliance/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py", line 1285, in get_cleaner_bill_no
    inv = inv.replace(replace, " ")
AttributeError: 'NoneType' object has no attribute 'replace'

Request Data

{
    "type": "POST",
    "args": {
        "doc": "{\"name\":\"Purchase Reconciliation Tool\",\"owner\":\"jithu.pettan@stergycleantech.com\",\"modified\":\"2023-11-23 14:01:41.812958\",\"modified_by\":\"jithu.pettan@stergycleantech.com\",\"docstatus\":0,\"idx\":\"0\",\"company\":\"Stergy Cleantech Private Limited\",\"include_ignored\":1,\"company_gstin\":\"32AAYCS8836K1ZG\",\"purchase_period\":\"Last Fiscal Year\",\"purchase_from_date\":\"2022-04-01\",\"purchase_to_date\":\"2023-03-31\",\"inward_supply_period\":\"Last Fiscal Year\",\"inward_supply_from_date\":\"2022-04-01\",\"inward_supply_to_date\":\"2023-03-31\",\"gst_return\":\"Both GSTR 2A & 2B\",\"is_modified\":0,\"reconciliation_data\":null,\"doctype\":\"Purchase Reconciliation Tool\",\"__unsaved\":true}",
        "action": "Save"
    },
    "freeze": true,
    "headers": {},
    "error_handlers": {},
    "url": "/api/method/frappe.desk.form.save.savedocs"
}

Response Data

{
    "exception": "AttributeError: 'NoneType' object has no attribute 'replace'"
}
vorasmit commented 11 months ago

Can you update your site and test if the error still persists? This was fixed in https://github.com/resilient-tech/india-compliance/pull/1273

jpettan commented 11 months ago

Yes, resolved after update