AttributeError: 'EmailTemplate' object has no attribute 'use_html'

Trying to uptate from v12 to v13 in a fresh install I got this message.

bench --site {site} migrate
Executing erpnext.patches.v13_0.add_default_interview_notification_templates in site1.local (_1bd3e0294da19198)

File “/home/erpadmin/frappe-bench/apps/frappe/frappe/email/doctype/email_template/email_template.py”, line 12, in validate
if self.use_html:

AttributeError: ‘EmailTemplate’ object has no attribute ‘use_html’

Using a try/except clause let de migrate continue but not ideal

class EmailTemplate(Document):
def validate(self):
try:
if self.use_html:
validate_template(self.response_html)
else:
validate_template(self.response)
except AttributeError:
validate_template(self.response)

I have just installed ERPNext v13.24.0 using Docker.

Previously used ERPNext V12 (not docker)

I am doing the migrate and getting the same error.

docker compose --project-name jen-erpnext exec backend bench --site jenza.erpn.dev.docker.jennyme.co.za migrate

File “/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_template/email_template.py”, line 12, in validate
if self.use_html:
AttributeError: ‘EmailTemplate’ object has no attribute ‘use_html’

The reply by BMO_Siluciones does not help me as it does not mention where that change needs to be made.

Please could someone post better instructions on how to get past this.

If there are specific instructions and methods to upgrade from v12 to v13, please share them or the link to them.

You assistance will be greatly appreciated.

Kind Regards
Christo Boucher

To add another data point, I am experiencing the same issue when I run bench migrate after restoring a database from a prior version (v12 I believe)

I’m using ERPNext/Frappe v13.24.0 running on a VM.

I worked around the issue by adding the --skip-failing to the end of the migrate command.

docker compose --project-name jen-erpnext exec backend bench --site {{site_url}} migrate –skip-failing

Hope that helps.

The patch add_default_interview_notification_templates.py in ERPNext requires the following line adding as the first line in execute.

It is a bug in the patch:

def execute():
        frappe.reload_doc('email', 'doctype', 'Email Template')

The field was added in v13 so the patch needs to use the latest schema from v13 and not the old v12 schema.

1 Like

This solved my issue.

Thanks!

1 Like