Version 12 to V13 upgrade Error

Hellow Community,
Am now getting the below error while trying to upgrade from v12 to 13.This happens after running : ```
bench update --patch

There was an issue while migrating the DocType: Stock Ledger Entry

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 99, in <module>
    main()
  File "/home/iteers/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/commands/site.py", line 296, in migrate
    skip_search_index=skip_search_index
  File "/home/iteers/frappe-bench/apps/frappe/frappe/migrate.py", line 70, in migrate
    frappe.model.sync.sync_all(verbose=verbose)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/sync.py", line 19, in sync_all
    sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/sync.py", line 70, in sync_for
    reset_permissions=reset_permissions, for_sync=True)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 70, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 143, in import_doc
    doc.insert()
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 268, in insert
    self.run_post_save_methods()
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 981, in run_post_save_methods
    self.run_method("on_update")
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 848, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 1133, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 1116, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/iteers/frappe-bench/apps/frappe/frappe/model/document.py", line 842, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 286, in on_update
    raise e
  File "/home/iteers/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 283, in on_update
    frappe.db.updatedb(self.name, Meta(self))
  File "/home/iteers/frappe-bench/apps/frappe/frappe/database/mariadb/database.py", line 292, in updatedb
    db_table.sync()
  File "/home/iteers/frappe-bench/apps/frappe/frappe/database/schema.py", line 37, in sync
    self.alter()
  File "/home/iteers/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py", line 88, in alter
    raise e
  File "/home/iteers/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py", line 75, in alter
    frappe.db.sql(query)
  File "/home/iteers/frappe-bench/apps/frappe/frappe/database/database.py", line 153, in sql
    self._cursor.execute(query)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
    result.read()
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/home/iteers/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1292, "Truncated incorrect INTEGER value: 'No'")
INFO: A newer version of bench is available: 5.1.0 → 5.2.1

I resolved the issue with the follow steps:

#Connet to Mariadb
bench --site mydomain.gsoftinnovation.net mariadb

#Select the erpnext db
show databases;
user _32a16936adc59731;

#Eliminate the value STRICT_TRANS_TABLES in “sql_mode” variable
SHOW VARIABLES LIKE ‘sql_mode’;
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SET GLOBAL sql_mode = ‘ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’;

#Continue the intallation with the command
bench update --patch

1 Like