Unable to deleted company's transactions


I am unable to delete all transactions for a company. I received this error.

desk.min.js:1565 Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 923, in call
return fn(*args, **newargs)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/setup/doctype/company/delete_company_transactions.py”, line 33, in delete_company_transactions
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 286, in save
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 562, in check_if_latest
(“Record does not exist”))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 319, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Record does not exist

Anyone in the community can advice me on this? Thanks!

Frappe is not able to find some document, to find out which you got to debug.
Print the self.doctype, self.docname before frappe.throw() in /home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py - line 562 and go on to find where it is referenced and why and so on.
The easy way if there is no other company,

  • export item, customer etc.
  • bench reinstall
  • import exported data :slight_smile:


1 Like