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/", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/", line 87, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 110, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 20, in main
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 782, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", 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/", 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/", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 31, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", 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/", line 76, in migrate
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 22, in sync_all
    sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 75, in sync_for
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 146, in import_file_by_path
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 275, in import_doc
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 291, in insert
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1085, in run_post_save_methods
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 941, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1261, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1243, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 938, in fn
    return method_object(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/", line 355, in on_update
    raise e
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/", line 352, in on_update
    frappe.db.updatedb(, Meta(self))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/", line 338, in updatedb
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/", line 40, in sync
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/", line 23, in create
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/", line 180, in sql
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", line 148, in execute
    result = self._query(query)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", line 310, in _query
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", 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/", line 775, in _read_query_result
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", line 1156, in read
    first_packet = self.connection._read_packet()
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", line 725, in _read_packet
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", line 221, in raise_for_error
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/", 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',
				(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.