Error while installing custom app on erpnext multi-tenant server

Hello everyone
i am trying to install custom app on erpnext multi-tenent server but getting error
i am trying by command.

  1. bench get-app application_name {{ source_link }}
    2.bench --site site_name install-app application_name

but am getting following error while installing app on website
Installing opcart…

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, 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 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, 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 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, 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 1060, 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 889, 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 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 168, in install_app
_install_app(app, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 145, in install_app
sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 56, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 65, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 100, in import_doc
doc = frappe.get_doc(docdict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 723, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 69, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 113, in init
super(Document, self).init(kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 54, in init
self.update(d)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 77, in update
self.set(key, value)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 124, in set
self.extend(key, value)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 161, in extend
self.append(key, v)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 155, in append
self.name, str(type(value))[1:-1], value)
ValueError: Document for field “field_order” attached to child table of “OnePageCart” must be a dict or BaseDocument, not type ‘unicode’ (enable_opc)

Thank you

Seems something wrong in doctypes.json file. Save doctype again to generate appropriate json.

1 Like

Thanks for reply. i deleted docktype folder( because i need to deal with only custom website for home page) but got AttributeError: ‘WebApplicationClient’ object has no attribute ‘populate_token_attributes’.
for cross check i tried to create custom app on server and install it on website by following command.
bench new-app myapp
bench --site www.xyz.com install-app myapp
then i got same error.

scope=self.scope
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py”, line 69, in init
self.token = token or {}
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py”, line 119, in token
self._client.populate_token_attributes(value)
AttributeError: ‘WebApplicationClient’ object has no attribute ‘populate_token_attributes’

Hi

I’m getting the same error when trying to install an app (that I just created) on a different server

I can’t install any custom apps. I even tried bench reinstall but with no luck.

ValueError: Document for field "field_order" attached to child table of "YouTube Upload Settings" must be a dict or BaseDocument, not type 'unicode' (clientid)

and

ValueError: Document for field "field_order" attached to child table of "Step Failure Mode" must be a dict or BaseDocument, not type 'unicode' (potential_failure_mode)

Can anyone duplicate this? I created a new app on bench (latest develop branch), and when trying install-app on another bench (latest production version), I get the above.

hello @dirkvdl16 i was able to solve the problem by deleting doctype folder because in my project there was no need for doctype-field. i dont know what would be the side effect of deleting doctype folder. but for now its working…
Thank you.

Thanks for the info.

I figure that there must’ve been a recent change on the develop branch of frappe that changes the json structure on how DocTypes are saved. So my Production instance can’t read the json file correctly when it tries to install the custom app I made with frappe (on the latest development branch).

I’ve now changed my Development VM to still be a development environment, but use the master branch. This solves it for me

2 Likes

Cool thanks @dirkvdl16. Also experienced this issue when trying to install a custom app created on the develop branch. I’ve also now switched to using a development environment on the master branch.

Did you rebuild your entire custom app from scratch using the master branch or were you able to change the existing custom app back in the develop branch?

Thanks!

I fixed the .json files of the affected doctypes manually. Comparing old and new, you’ll see the structure changes, and be able to rejig your file to the old structure

ValueError: Document attached to child table must be a dict or BaseDocument, not type ‘unicode’ while installing custom app. Please assist to resolve this error.

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, 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 94, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, 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 722, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, 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 1066, 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 895, 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 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 33, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, 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 45, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 100, in import_doc
doc = frappe.get_doc(docdict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 638, in get_doc
return frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 68, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 112, in init
super(Document, self).init(kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 54, in init
self.update(d)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 77, in update
self.set(key, value)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 124, in set
self.extend(key, value)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 152, in extend
self.append(key, v)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 146, in append
"Document attached to child table must be a dict or BaseDocument, not " + str(type(value))[1:-1]
ValueError: Document attached to child table must be a dict or BaseDocument, not type ‘unicode’

Solution

I have made app with the structure of version 12 and after checking I get to know that client have ERPNext with version 10 So due to incompatibility I faced error.