fix: check if doctype exists before replacing null values

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2019-09-27 12:55:50 +05:30
parent a1c8a9bdc2
commit ddcdabbf6d
No known key found for this signature in database
GPG key ID: 75507BE256F40CED

View file

@ -14,7 +14,7 @@ def execute():
update_column_table_map[field.TABLE_NAME].append("`{fieldname}`=COALESCE(`{fieldname}`, 0)".format(fieldname=field.COLUMN_NAME))
for table in frappe.db.get_tables():
if update_column_table_map.get(table):
if update_column_table_map.get(table) and frappe.db.exists("DocType", table.replace("tab", "")):
frappe.db.sql("""UPDATE `{table}` SET {columns}"""
.format(table=table, columns=", ".join(update_column_table_map.get(table))))