"Account None not found" error when confirming a sales return (credit note)

I am facing an extremely difficult error (possible bug?) on ERPNext (Managed Hosting).
An error message of “Not found | Account None not found | The resource you are looking for is not available” pops up every time I try to submit a return to a sales invoice.
After a lot of “trial and error” I found the following:

  • Invoice items and company settings most probably have nothing to do with the error. As I managed to do a return of a test invoice that has no shipping rule set.

  • The error occurs exclusively when there is a shipping rule on the original sales invoice, regardless of the shipping fee (0 or >0).

I am officially out of solutions; I tried every possible alternation to the configuration of the return in a test database but couldn’t do more than just narrowing the error scope to the 2 points mentioned above.

image_1869

Might help you help me:

Sales and Taxes section of original invoice

Sales and Taxes section of sales return (auto-generated by ERPNext):

Maybe you can share the js console traceback. With that is more easy to look at the problem.
If you don’t know how to do it, just press F12 after you get the message and it will open the console in your browser, and there you will se a big text with the error.

Thank you for your help. Here’s the traceback:

Traceback (most recent call last):
File “apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “apps/frappe/frappe/model/document.py”, line 938, in submit
return self._submit()
File “apps/frappe/frappe/model/document.py”, line 926, in _submit
return self.save()
File “apps/frappe/frappe/model/document.py”, line 285, in save
return self._save(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 340, in _save
self.run_post_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1006, in run_post_save_methods
self.run_method(“on_submit”)
File “apps/frappe/frappe/model/document.py”, line 867, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1160, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1143, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/document.py”, line 861, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 232, in on_submit
self.make_gl_entries()
File “apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 840, in make_gl_entries
make_gl_entries(gl_entries, update_outstanding=update_outstanding, merge_entries=False, from_repost=from_repost)
File “apps/erpnext/erpnext/accounts/general_ledger.py”, line 25, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding, from_repost)
File “apps/erpnext/erpnext/accounts/general_ledger.py”, line 158, in save_entries
make_entry(entry, adv_adj, update_outstanding, from_repost)
File “apps/erpnext/erpnext/accounts/general_ledger.py”, line 167, in make_entry
gle.submit()
File “apps/frappe/frappe/model/document.py”, line 938, in submit
return self._submit()
File “apps/frappe/frappe/model/document.py”, line 926, in _submit
return self.save()
File “apps/frappe/frappe/model/document.py”, line 285, in save
return self.save(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 307, in save
self.insert()
File “apps/frappe/frappe/model/document.py”, line 238, in insert
self.run_before_save_methods()
File “apps/frappe/frappe/model/document.py”, line 973, in run_before_save_methods
self.run_method(“validate”)
File “apps/frappe/frappe/model/document.py”, line 867, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1160, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1143, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/document.py”, line 861, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 40, in validate
self.pl_must_have_cost_center()
File “apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 91, in pl_must_have_cost_center
if frappe.get_cached_value(“Account”, self.account, “report_type”) == “Profit and Loss”:
File “apps/frappe/frappe/init.py”, line 858, in get_cached_value
doc = get_cached_doc(doctype, name)
File “apps/frappe/frappe/init.py”, line 843, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “apps/frappe/frappe/init.py”, line 886, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 75, in get_doc
return controller(*args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 113, in init
self.load_from_db()
File “apps/frappe/frappe/model/document.py”, line 156, in load_from_db
frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “apps/frappe/frappe/init.py”, line 439, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File “apps/frappe/frappe/init.py”, line 418, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 372, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Account None not found

up ^^^