Errors in bench update from ver 12 to 13

Hi,

When I try to upgrade ver 12 to 13 with an instance that has two sites, I get the following error:

Traceback (most recent call last):
File “/usr/local/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/local/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 309, in migrate
skip_search_index=skip_search_index
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 69, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py”, line 19, in execute
‘owner’: ‘Administrator’
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 142, in create_custom_field
custom_field.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 268, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1001, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 860, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1158, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1141, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 854, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 76, in on_update
validate_fields_for_doctype(self.dt)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 751, in validate_fields_for_doctype
validate_fields(meta)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 1062, in validate_fields
validate_data_field_type(d)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 1016, in validate_data_field_type
frappe.msgprint(text_str + df_options_str, title=“Invalid Data Field”, raise_exception=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 418, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 374, in _raise_exception
raise ValidationError(msg)
frappe.exceptions.ValidationError: Customer GSTIN is an invalid Data field.

Only Options allowed for Data field are:

  • Email
  • Name
  • Phone
  • URL
  • Barcode

Thanks to Revant’s post, I know the solution to that is:

But when I run that on the site, I get the following error:

field: Purchase Order-supp_state
fieldtype: Data
Invalid options: supplier_address.gst_state

OperationalError Traceback (most recent call last)
~/frappe-bench/apps/frappe/frappe/commands/utils.py in
14 f = frappe.get_doc(“Custom Field”, name)
15 f.options = None
—> 16 f.save()
17 frappe.db.commit()
18

~/frappe-bench/apps/frappe/frappe/model/document.py in save(self, *args, **kwargs)
283 def save(self, *args, **kwargs):
284 “”“Wrapper for _save”“”
→ 285 return self._save(*args, **kwargs)
286
287 def _save(self, ignore_permissions=None, ignore_version=None):

~/frappe-bench/apps/frappe/frappe/model/document.py in _save(self, ignore_permissions, ignore_version)
318 self.validate_higher_perm_levels()
319 self._validate_links()
→ 320 self.run_before_save_methods()
321
322 if self._action != “cancel”:

~/frappe-bench/apps/frappe/frappe/model/document.py in run_before_save_methods(self)
960 # before_validate method should be executed before ignoring validations
961 if self._action in (“save”, “submit”):
→ 962 self.run_method(“before_validate”)
963
964 if self.flags.ignore_validate:

~/frappe-bench/apps/frappe/frappe/model/document.py in run_method(self, method, *args, **kwargs)
861
862 self.run_notifications(method)
→ 863 run_webhooks(self, method)
864 run_server_script_for_doc_event(self, method)
865

~/frappe-bench/apps/frappe/frappe/integrations/doctype/webhook/init.py in run_webhooks(doc, method)
23 webhooks_list = frappe.get_all(‘Webhook’,
24 fields=[“name”, “condition”, “webhook_docevent”, “webhook_doctype”],
—> 25 filters={“enabled”: True}
26 )
27

~/frappe-bench/apps/frappe/frappe/init.py in get_all(doctype, *args, **kwargs)
1467 if not “limit_page_length” in kwargs:
1468 kwargs[“limit_page_length”] = 0
→ 1469 return get_list(doctype, *args, **kwargs)
1470
1471 def get_value(*args, **kwargs):

~/frappe-bench/apps/frappe/frappe/init.py in get_list(doctype, *args, **kwargs)
1440 “”"
1441 import frappe.model.db_query
→ 1442 return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, **kwargs)
1443
1444 def get_all(doctype, *args, **kwargs):

~/frappe-bench/apps/frappe/frappe/model/db_query.py in execute(self, fields, filters, or_filters, docstatus, group_by, order_by, limit_start, limit_page_length, as_list, with_childnames, debug, ignore_permissions, user, with_comment_count, join, distinct, start, page_length, limit, ignore_ifnull, save_user_settings, save_user_settings_fields, update, add_total_row, user_settings, reference_doctype, return_query, strict, pluck, ignore_ddl)
105 if not self.columns: return
106
→ 107 result = self.build_and_run()
108 if return_query:
109 return result

~/frappe-bench/apps/frappe/frappe/model/db_query.py in build_and_run(self)
143 else:
144 return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug,
→ 145 update=self.update, ignore_ddl=self.ignore_ddl)
146
147 def prepare_args(self):

~/frappe-bench/apps/frappe/frappe/database/database.py in sql(self, query, values, as_dict, as_list, formatted, debug, ignore_ddl, as_utf8, auto_commit, update, explain)
152
153 else:
→ 154 self._cursor.execute(query)
155
156 if frappe.flags.in_migrate:

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/cursors.py in execute(self, query, args)
146 query = self.mogrify(query, args)
147
→ 148 result = self._query(query)
149 self._executed = query
150 return result

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/cursors.py in _query(self, q)
308 self._last_executed = q
309 self._clear_result()
→ 310 conn.query(q)
311 self._do_get_result()
312 return self.rowcount

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/connections.py in query(self, sql, unbuffered)
546 sql = sql.encode(self.encoding, “surrogateescape”)
547 self._execute_command(COMMAND.COM_QUERY, sql)
→ 548 self._affected_rows = self._read_query_result(unbuffered=unbuffered)
549 return self._affected_rows
550

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/connections.py in _read_query_result(self, unbuffered)
773 else:
774 result = MySQLResult(self)
→ 775 result.read()
776 self._result = result
777 if result.server_status is not None:

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/connections.py in read(self)
1154 def read(self):
1155 try:
→ 1156 first_packet = self.connection._read_packet()
1157
1158 if first_packet.is_ok_packet():

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/connections.py in _read_packet(self, packet_type)
723 if self._result is not None and self._result.unbuffered_active is True:
724 self._result.unbuffered_active = False
→ 725 packet.raise_for_error()
726 return packet
727

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/protocol.py in raise_for_error(self)
219 if DEBUG:
220 print(“errno =”, errno)
→ 221 err.raise_mysql_exception(self._data)
222
223 def dump(self):

~/frappe-bench/env/lib/python3.7/site-packages/pymysql/err.py in raise_mysql_exception(data)
141 if errorclass is None:
142 errorclass = InternalError if errno < 1000 else OperationalError
→ 143 raise errorclass(errno, errval)

OperationalError: (1054, “Unknown column ‘tabWebhook.enabled’ in ‘where clause’”)

Any suggestions to solve this?