Getting this error "Company None not found The resource you are looking for is not available" while sending email

I am facing this kind of error while sending email to customer.

From which document have sent this email ? The field for company probably is empty and when It is trying find a company called None it is not able to find since no such company has been defined and setup.

when I access the customer and want to print then again getting this error

ERPNext: v11.1.18 (master)
Frappe Framework: v11.1.18 (master)

Same issue - fix is supposedly is something like geting the list of Departments and to make sure that every department is associated with a Company. Same goes for Projects - the Project is associated with a Department and if the Department is not associated with a Company then the error will show.

This does not resolve the issue.

Cause of error: After changing email password, the error started showing up.

Error Log:

Traceback (most recent call last):
File “/opt/bench/erpnext/apps/frappe/frappe/email/queue.py”, line 423, in send_one
message = prepare_message(email, recipient.recipient, recipients_list)
File “/opt/bench/erpnext/apps/frappe/frappe/email/queue.py”, line 554, in prepare_message
print_format_file = frappe.attach_print(**attachment)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1377, in attach_print
“fcontent”: get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True, doc=doc, no_letterhead=no_letterhead)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1351, in get_print
html = build_page(“printview”)
File “/opt/bench/erpnext/apps/frappe/frappe/website/render.py”, line 178, in build_page
context = get_context(path)
File “/opt/bench/erpnext/apps/frappe/frappe/website/context.py”, line 28, in get_context
context = build_context(context)
File “/opt/bench/erpnext/apps/frappe/frappe/website/context.py”, line 98, in build_context
update_controller_context(context, context.controller)
File “/opt/bench/erpnext/apps/frappe/frappe/website/context.py”, line 48, in update_controller_context
ret = module.get_context(context)
File “/opt/bench/erpnext/apps/frappe/frappe/www/printview.py”, line 40, in get_context
no_letterhead=frappe.form_dict.no_letterhead),
File “/opt/bench/erpnext/apps/frappe/frappe/www/printview.py”, line 158, in get_html
html = template.render(args, filters={“len”: len})
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “/opt/bench/erpnext/apps/frappe/frappe/./templates/print_formats/standard.html”, line 32, in top-level template code
{{ render_field(df, doc) }}
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/opt/bench/erpnext/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 18, in template
{{ render_field_with_label(df, doc) }}
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/opt/bench/erpnext/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 88, in template
{{ _(print_value(df, doc)) }}{% endif %}
File “/opt/bench/erpnext/env/lib/python3.6/site-packages/jinja2/runtime.py”, line 579, in invoke
rv = self.func(*arguments)
File “/opt/bench/erpnext/apps/frappe/frappe/./templates/print_formats/standard_macros.html”, line 134, in template
{{ doc.get_formatted(df.fieldname, parent_doc or doc, translated=df.translatable) }}
File “/opt/bench/erpnext/apps/frappe/frappe/model/base_document.py”, line 715, in get_formatted
return format_value(val, df=df, doc=doc, currency=currency)
File “/opt/bench/erpnext/apps/frappe/frappe/utils/formatters.py”, line 60, in format_value
currency=currency if currency else (get_field_currency(df, doc) if doc else None))
File “/opt/bench/erpnext/apps/frappe/frappe/model/meta.py”, line 484, in get_field_currency
currency = frappe.get_cached_value(split_opts[0], doc.get(split_opts[1]), split_opts[2])
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 697, in get_cached_value
doc = get_cached_doc(doctype, name)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 682, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 725, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 69, in get_doc
return controller(*args, **kwargs)
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 104, in init
self.load_from_db()
File “/opt/bench/erpnext/apps/frappe/frappe/model/document.py”, line 141, in load_from_db
frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 352, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 338, in msgprint
_raise_exception()
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 311, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Company None not found