Occuring Error When Cancelling the Document

When Cancelling the Loan Repayment Document Which Made for test Showing Server Error

image

How to Overcome form this type of Error’s?

Hi @RajeshV

Can you please send a full error ?
Thanks

@NCP @ankush
We have issue on Deleting Loan repayment

Attaching the Explained error Below:

Route

Form/Loan Repayment/LM-REP-0001

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 1603, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 50, in cancel
    doc.cancel()
  File "apps/frappe/frappe/model/document.py", line 991, in cancel
    return self._cancel()
  File "apps/frappe/frappe/model/document.py", line 973, in _cancel
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 305, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 357, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1071, in run_post_save_methods
    self.run_method("on_cancel")
  File "apps/frappe/frappe/model/document.py", line 899, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1251, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1233, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 896, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py", line 42, in on_cancel
    self.update_repayment_schedule(cancel=1)
  File "apps/erpnext/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py", line 273, in update_repayment_schedule
    regenerate_repayment_schedule(self.against_loan, cancel)
  File "apps/erpnext/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py", line 635, in regenerate_repayment_schedule
    while balance_amount > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

Request Data

{
	"type": "POST",
	"args": {
		"doctype": "Loan Repayment",
		"name": "LM-REP-0001"
	},
	"btn": {
		"jQuery360027414526865408221": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 449,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.cancel"
}

Response Data

{
	"exception": "TypeError: '>' not supported between instances of 'NoneType' and 'int'"
}

Hi @Dhruvin-Bhaliya

I Posted the full error Content, Check and resolve the issue.
Thanks