I have run into issues that seemed to only come about after the File Data table was renamed File. It refuses to install stating it can’t insert a custom field after a field “file_url”. I managed to get past this by removing the “insert after” clause in the Jasper fixtures/custom_field.json file, but the developer says this is not an issue in his code and suggests I push it up to the frappe folks. He thinks I will keep getting this error with subsequent updates. Any ideas on this?
Seems issue with custom fields. Can you post custom field json which causing issue.
Here you go. I removed the line: "insert_after": "file_url",
and it worked fine after that…but the author says it will probably fail on updates this way.
Here is the full file:
[
{
"allow_on_submit": 0,
"default": null,
"depends_on": null,
"description": "Name of the parent report.",
"docstatus": 0,
"doctype": "Custom Field",
"dt": "File",
"fieldname": "attached_to_report_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"insert_after": "file_url",
"label": "Attached To Report Name",
"modified": "2015-10-01 17:20:19.032730",
"name": "File-attached_to_report_name",
"no_copy": 0,
"options": null,
"permlevel": 0,
"precision": null,
"print_hide": 0,
"print_width": null,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"unique": 0,
"width": null
}
]
hi,
Please share error log and don’t remove “insert_after” attribute.
I did a git reset --hard and git pull to return to the original source. Sure enough, bench update produces the following:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
main()
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
click.Group(commands=commands)(prog_name='bench')
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 680, in main
rv = self.invoke(ctx)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 16, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands.py", line 218, in migrate
sync_fixtures()
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py", line 19, in sync_fixtures
import_doc(frappe.get_app_path(app, "fixtures", fname), ignore_links=True, overwrite=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/data_import_tool.py", line 94, in import_doc
frappe.modules.import_file.import_file_by_path(f, data_import=True, force=True, pre_process=pre_process)
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 54, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 122, in import_doc
doc.insert()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 210, in insert
self.run_post_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 605, in run_post_save_methods
self.run_method("on_update")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 549, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 681, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 664, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 543, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 39, in on_update
self.create_property_setter()
File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/custom_field/custom_field.py", line 62, in create_property_setter
.format(self.insert_after, self.label), frappe.DoesNotExistError)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 257, in throw
msgprint(msg, raise_exception=exc)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 250, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 235, in _raise_exception
raise raise_exception, encode(msg)
frappe.exceptions.DoesNotExistError: Insert After field 'file_url' mentioned in Custom Field 'Attached To Report Name', does not exist
Traceback (most recent call last):
File "/usr/local/bin/bench", line 9, in <module>
load_entry_point('bench==0.92', 'console_scripts', 'bench')()
File "/home/frappe/bench-repo/bench/cli.py", line 60, in cli
bench()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 680, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/home/frappe/bench-repo/bench/cli.py", line 240, in _update
update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
File "/home/frappe/bench-repo/bench/cli.py", line 270, in update
patch_sites(bench=bench_path)
File "/home/frappe/bench-repo/bench/utils.py", line 158, in patch_sites
run_frappe_cmd('--site', 'all', 'migrate', bench=bench)
File "/home/frappe/bench-repo/bench/utils.py", line 489, in run_frappe_cmd
raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')
FYI, the field file_url DOES exist in the File table. Here is the schema for that table below:
CREATE TABLE `tabFile` (
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`creation` datetime(6) DEFAULT NULL,
`modified` datetime(6) DEFAULT NULL,
`modified_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`owner` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`docstatus` int(1) NOT NULL DEFAULT '0',
`parent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parentfield` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`parenttype` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`idx` int(8) DEFAULT NULL,
`file_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`file_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`module` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`attached_to_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`file_size` int(11) DEFAULT NULL,
`attached_to_doctype` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`content_hash` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`rgt` int(11) DEFAULT NULL,
`is_home_folder` int(1) NOT NULL DEFAULT '0',
`old_parent` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`lft` int(11) DEFAULT NULL,
`is_attachments_folder` int(1) NOT NULL DEFAULT '0',
`is_folder` int(1) NOT NULL DEFAULT '0',
`folder` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`attached_to_report_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `parent` (`parent`),
KEY `attached_to_name` (`attached_to_name`),
KEY `attached_to_doctype` (`attached_to_doctype`),
KEY `attached_to_doctype_attached_to_name_index` (`attached_to_doctype`,`attached_to_name`),
KEY `content_hash` (`content_hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED;
The fixtures .json file is below. This is what was used when I encountered the error above (putting it back to the original per @saurabh6790
[
{
“allow_on_submit”: 0,
“default”: null,
“depends_on”: null,
“description”: “Name of the parent report.”,
“docstatus”: 0,
“doctype”: “Custom Field”,
“dt”: “File”,
“fieldname”: “attached_to_report_name”,
“fieldtype”: “Data”,
“hidden”: 0,
“ignore_user_permissions”: 0,
“in_filter”: 0,
“in_list_view”: 1,
“insert_after”: “file_url”,
“label”: “Attached To Report Name”,
“modified”: “2015-10-01 17:20:19.032730”,
“name”: “File-attached_to_report_name”,
“no_copy”: 0,
“options”: null,
“permlevel”: 0,
“precision”: null,
“print_hide”: 0,
“print_width”: null,
“read_only”: 1,
“report_hide”: 0,
“reqd”: 0,
“search_index”: 0,
“unique”: 0,
“width”: null
}
]