[v12] Can't send Documents via Email after upgrading to v12

Installed Apps
ERPNext: v12.1.2 (version-12)
Frappe Framework: v12.0.12 (version-12)

After upgrading ERPNext from v11 to v12 and migrating python from v2 to v3.6 I receive the following error when I try to send a document via email.

Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 55, in handle
return frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 1036, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py", line 73, in make
}).insert(ignore_permissions=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 228, in insert
self.run_before_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 886, in run_before_save_methods
self.run_method("validate")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 786, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1056, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1039, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 780, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 65, in validate
self.set_timeline_links()
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 263, in set_timeline_links
self.add_link('Contact', contact_name)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py", line 288, in add_link
"link_name": link_name
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 149, in append
value = self._init_child(value, key)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 184, in _init_child
value["doctype"] = self.get_table_field_doctype(key)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 298, in get_table_field_doctype
return self.meta.get_field(fieldname).options
AttributeError: 'NoneType' object has no attribute 'options'

Please also refer: https://github.com/frappe/erpnext/issues/19078

Any ideas how to solve the issue?

As stated by @hrwx here

The below two commands resolved the issue.

bench --force reload-doc core doctype communication_link
bench --force reload-doc core doctype communication
5 Likes

Can confirm that reloading the doctypes works. :+1:

2 Likes