question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Print format validation fails on migrate

See original GitHub issue

Reproduce

  • Have a custom app built for version-11, containing print formats
  • Set up a new server with version-12
  • Install custom app and restore database from old server
  • Run bench migrate

Error

> bench migrate
Migrating erp.my_company.com
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Updating DocTypes for my_app       : [========================================]
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 "frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 99, in <module>
    main()
  File "frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "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 "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 "frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "frappe-bench/apps/frappe/frappe/commands/__init__.py", line 26, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "frappe-bench/apps/frappe/frappe/commands/site.py", line 266, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
  File "frappe-bench/apps/frappe/frappe/migrate.py", line 52, in migrate
    sync_fixtures()
  File "frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 24, in sync_fixtures
    ignore_links=True, overwrite=True)
  File "frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 194, in import_doc
    f, data_import=True, force=True, pre_process=pre_process, reset_permissions=True
  File "frappe-bench/apps/frappe/frappe/modules/import_file.py", line 66, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
  File "frappe-bench/apps/frappe/frappe/modules/import_file.py", line 141, in import_doc
    doc.insert()
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 230, in insert
    self.run_before_save_methods()
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 896, in run_before_save_methods
    self.run_method("validate")
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 797, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 1071, in composer
    return composed(self, method, *args, **kwargs)
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 1054, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "frappe-bench/apps/frappe/frappe/model/document.py", line 791, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "frappe-bench/apps/frappe/frappe/printing/doctype/print_format/print_format.py", line 38, in validate
    frappe.throw(_('{0} is required').format(frappe.bold(_('HTML'))), frappe.MandatoryError)
  File "frappe-bench/apps/frappe/frappe/__init__.py", line 376, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable)
  File "frappe-bench/apps/frappe/frappe/__init__.py", line 355, in msgprint
    _raise_exception()
  File "frappe-bench/apps/frappe/frappe/__init__.py", line 315, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.MandatoryError: <b>HTML</b> is required

Caused by this line:

https://github.com/frappe/frappe/blob/e384c826dcc54f2b1f4e697e2dace3e05c849d3a/frappe/printing/doctype/print_format/print_format.py#L37-L38

I tried to remove all print formats containing "custom_format": 1, but the error remained.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
surajshetty3416commented, Aug 7, 2020

@barredterra It seems suggestion by Chinmay should resolve the issue.

Closing this issue for now. Please re-open if you are still facing this issue.

1reaction
Thunderbottomcommented, Jul 2, 2020

okay, is there a fixtures folder with the custom print formats inside your custom app folder?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving Migration Validation Errors - Oracle Help Center
The most common validation error in Narrative Reporting is when the data source name in Reports ; If you do not have a...
Read more >
Passing a valid date string with Joi.date() validation ... - GitHub
I have a query parameter of date string and set convert option to false. Joi.validate fails and returns error "'startDate' must be a...
Read more >
Validation of process templates for migration import
Guidance for fixing common data migration tool process template issues.
Read more >
Command-line: validate - Flyway
Validation fails if. differences in migration names, types or checksums are found; versions have been applied that aren't resolved locally anymore ...
Read more >
Migration File Validation Tool - Ex Libris Knowledge Center
Verifying the file structure and format. In order for the migration programs to successfully load your data, the exported files must be in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found