ERPnext version 13, POS Closing Entry- Invalid default value for 'period_end_date'

Any ideas??

I was upgrading from version 13.2, I have tried changing default value in database or json fie but no luck

Updating DocTypes for frappe        : [========================================] 100%
Updating DocTypes for erpnext       : [==                                      ] 5%

There was an issue while migrating the DocType: POS Closing Entry


Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 110, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.8/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.8/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.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/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 31, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 407, in migrate
    migrate(context.verbose, skip_failing=skip_failing, skip_search_index=skip_search_index)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 76, in migrate
    frappe.model.sync.sync_all(verbose=verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 22, in sync_all
    sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py", line 75, in sync_for
    import_file_by_path(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 146, in import_file_by_path
    import_doc(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 275, in import_doc
    doc.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_post_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1085, in run_post_save_methods
    self.run_method("on_update")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 938, in fn
    return method_object(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 355, in on_update
    raise e
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 352, in on_update
    frappe.db.updatedb(self.name, Meta(self))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py", line 338, in updatedb
    db_table.sync()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/schema.py", line 40, in sync
    self.create()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py", line 23, in create
    frappe.db.sql(
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 180, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1067, "Invalid default value for 'period_end_date'")

Still finding out, I am review the query of bench migrate and it does this:

			where parent = '__default' order by creation
		   360 Query	select defkey, defvalue from `tabDefaultValue`
			where parent = '__global' order by creation
		   360 Query	SELECT * FROM `tabCustom Field`
			WHERE dt = 'POS Closing Entry' AND docstatus < 2
		   360 Query	select * from `tabProperty Setter` where
			doc_type='POS Closing Entry'
		   360 Query	select *
			from `tabCustom DocPerm`
			where `tabCustom DocPerm`.`parent` = 'POS Closing Entry'
			
			 order by `tabCustom DocPerm`.`modified` ASC
220826  7:59:05	   360 Query	select *
			from `tabDocType Link`
			where `tabDocType Link`.`parent` = 'POS Closing Entry' and `tabDocType Link`.`custom` = 1.0
			
			 order by `tabDocType Link`.`modified` DESC
		   360 Query	select *
			from `tabDocType Action`
			where `tabDocType Action`.`parent` = 'POS Closing Entry' and `tabDocType Action`.`custom` = 1.0
			
			 order by `tabDocType Action`.`modified` DESC
		   360 Query	select issingle from `tabDocType` where name='POS Closing Entry'
		   360 Query	select
			column_name as 'name',
			column_type as 'type',
			column_default as 'default',
			COALESCE(
				(select 1
				from information_schema.statistics
				where table_name="tabPOS Closing Entry"
					and column_name=columns.column_name
					and NON_UNIQUE=1
					limit 1
			), 0) as 'index',
			column_key = 'UNI' as 'unique'
			from information_schema.columns as columns
			where table_name = 'tabPOS Closing Entry'
		   360 Query	commit
		   360 Query	ALTER TABLE `tabPOS Closing Entry` MODIFY `period_end_date` datetime(6) default '09/22/2021', MODIFY `total_quantity` decimal(21,9) not null default 0

Don’t know where is he taking that date “datetime(6) default ‘09/22/2021’”

I changed the json file on erpnext column type to varchar, installation went smoothly and then change it back, at the end there were no data in that table.