Update Error: frappe.exceptions.ValidationError: Options must be a valid DocType for field Print Style in row 16

Hi, we get this when trying to update, our current version are:
erpnext 10.1.42
frappe 10.1.39

This problem is similar to this one posted a year ago:

Patching sites…
Migrating site1.local
Executing erpnext.patches.v7_0.remove_features_setup in site1.local (site1.local)
Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/patches/v7_0/remove_features_setup.py”, line 14, in execute
create_compact_item_print_custom_field()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/setup/install.py”, line 54, in create_compact_item_print_custom_field
‘insert_after’: ‘with_letterhead’
File “/home/erpnext/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 111, in create_custom_field
“hidden”: df.hidden or 0
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 248, in insert
self.run_post_save_methods()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 890, in run_post_save_methods
self.run_method(“on_update”)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 758, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1027, in composer
return composed(self, method, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1010, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 752, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py”, line 56, in on_update
validate_fields_for_doctype(self.dt)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 420, in validate_fields_for_doctype
validate_fields(frappe.get_meta(doctype, cached=False))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 662, in validate_fields
check_link_table_options(d)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 466, in check_link_table_options
frappe.throw(
(“Options must be a valid DocType for field {0} in row {1}”).format(d.label, d.idx))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.ValidationError: Options must be a valid DocType for field Print Style in row 16

1 Like

OK, we are confirming now that the version is actually updated:
bench version
erpnext 10.1.51
frappe 10.1.46

But the error prevents the site to be available. Any ideas?

Hi @info did you solve this problem? :slight_smile:

Not yet, the error keeps showing when bench update.

I guess a fix is needed in ERPNext…

I solved it through this
bench --force --site site1.local reload-doc printing doctype print_style
then try bench update again :slight_smile:

2 Likes

Thanks, it worked!! But now we get another error, sadly:
frappe.exceptions.DoesNotExistError: DocType Project Type not found

Here is the full trace.
Executing erpnext.patches.v7_0.convert_timelog_to_timesheet in site1.local (site1.local)
Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/patches/v7_0/convert_timelog_to_timesheet.py”, line 36, in execute
time_sheet.save(ignore_permissions=True)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 282, in _save
self.insert()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 248, in insert
self.run_post_save_methods()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 893, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 758, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1027, in composer
return composed(self, method, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1010, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 752, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/timesheet/timesheet.py”, line 106, in on_submit
self.update_task_and_project()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/timesheet/timesheet.py”, line 169, in update_task_and_project
frappe.get_doc(“Project”, data.project).update_project()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/project/project.py”, line 182, in update_project
self.save(ignore_permissions = True)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 292, in _save
self.validate_links()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 717, in validate_links
invalid_links, cancelled_links = self.get_invalid_links()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 462, in get_invalid_links
if frappe.get_meta(doctype).issingle:
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 655, in get_meta
return frappe.model.meta.get_meta(doctype, cached=cached)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in get_meta
lambda: Meta(doctype))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 173, in hget
value = generator()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/meta.py”, line 33, in
lambda: Meta(doctype))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/meta.py”, line 72, in init
super(Meta, self).init(“DocType”, doctype)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 103, in init
self.load_from_db()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/meta.py”, line 77, in load_from_db
super(Meta, self).load_from_db()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 140, in load_from_db
frappe.throw(
("{0} {1} not found").format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.DoesNotExistError: DocType Project Type not found

OK, solved the last problem with:
bench --force --site site1.local reload-doc projects doctype project_type

Now we get:
frappe.exceptions.LinkValidationError: Could not find Project Type: Internal

Full trace:
Executing erpnext.patches.v7_0.convert_timelog_to_timesheet in site1.local (site1.local)
Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/patches/v7_0/convert_timelog_to_timesheet.py”, line 36, in execute
time_sheet.save(ignore_permissions=True)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 282, in _save
self.insert()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 248, in insert
self.run_post_save_methods()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 893, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 758, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1027, in composer
return composed(self, method, *args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1010, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 752, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/timesheet/timesheet.py”, line 106, in on_submit
self.update_task_and_project()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/timesheet/timesheet.py”, line 169, in update_task_and_project
frappe.get_doc(“Project”, data.project).update_project()
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/projects/doctype/project/project.py”, line 182, in update_project
self.save(ignore_permissions = True)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 292, in _save
self._validate_links()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 727, in _validate_links
frappe.LinkValidationError)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
frappe.exceptions.LinkValidationError: Could not find Project Type: Internal

This is the current error now when trying bench update, erpnext and frappe seem to be updated without problems but migrating the sites seem to be the main problem when upgrading…

bench version
erpnext 10.1.51
frappe 10.1.46