Version 14 Update: Workspace

My app was created and developed on ERPNext Version 13. It is working fine with the latest version 13 update. But it is not installing on Version 14-beta. The error is:

Installing test_app...
Updating DocTypes for test_app  : [========================================] 100%
An error occurred while installing test_app: Content data shoud be a list
Traceback (most recent call last):
  File "apps/frappe/frappe/desk/doctype/workspace/workspace.py", line 22, in validate
    if not isinstance(loads(self.content), list):
  File "/usr/lib/python3.8/json/__init__.py", line 341, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 344, in install_app
    _install_app(app, verbose=context.verbose)
  File "apps/frappe/frappe/installer.py", line 264, in install_app
    sync_fixtures(name)
  File "apps/frappe/frappe/utils/fixtures.py", line 24, in sync_fixtures
    import_doc(frappe.get_app_path(app, "fixtures", fname))
  File "apps/frappe/frappe/core/doctype/data_import/data_import.py", line 216, in import_doc
    import_file_by_path(
  File "apps/frappe/frappe/modules/import_file.py", line 132, in import_file_by_path
    import_doc(
  File "apps/frappe/frappe/modules/import_file.py", line 237, in import_doc
    doc.insert()
  File "apps/frappe/frappe/model/document.py", line 233, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 973, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 870, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1166, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1149, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 867, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/desk/doctype/workspace/workspace.py", line 25, in validate
    frappe.throw(_("Content data shoud be a list"))
  File "apps/frappe/frappe/__init__.py", line 448, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "apps/frappe/frappe/__init__.py", line 427, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 382, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Content data shoud be a list

The app installed once I removed all my workspace.json files, that caused my UI to break though. Can anyone suggest what changes should I make?

It looks like there is a difference in the workspace data structure between version-13 and develop. Most likely you will have to recreate your workspace in develop branch and export the workspace to your custom app again.

Yes!
Actually there is a new key-value pair named “content”. It is a list containing all data about the workspace. That is missing.

2 Likes

Did you find any solution to this problem, as I am unable to create any new workspace too

You will have to update your workspace json files. It is part of the migration guide. Check below link

3 Likes

This past weekend, I upgraded one of my custom Apps from v13 to v14.
The first error I encountered was what @ayushi_srivastava mentioned:

ValidationError:  Content data should be a list

I was able to temporarily bypass this by performing an update using SQL:

UPDATE `tabWorkspace`
SET content = '[]'
WHERE name = 'my_workspace_name'

I read the “Migrating to Version 14” guide, examined my existing JSON, and compared to the JSON of several v14 Frappe workspaces. I decided it would be easier/faster to just start from scratch. So I took a screenshot of my v13 Workspace, and manually re-created using the new v14 UI.

This didn’t take long, and turned out really great. :+1:

I love the new v14 Workspaces; I was impressed with how flexible and customizable they are. My only feedback is that I miss some of the extra colors/shading from v13. The new Workspaces are excellent, but kind of bland.

6 Likes

@brian_pond How did you get the workspace contents to show for other users? I’ve tried everything but the workspace contents do not show for other users except the administrator even though the workspace is marked as public, is populated with doctypes, and can be accessed by all users from the sidebar. The page is always blank.

@flexy2ky Good question, but I don’t have any answers. The post above was just a weekend experiment. My own customers are using v13 and lower. If someone else is using my App in v14, I don’t know who they are. (it’s open source)

If users don’t have access to the content added to the public workspace it will not be visible to them.

1 Like

@brian_pond

This turned out to be the best move forward for me too and thanks @shariquerik for the tip on how to display the card contents to other users. It is really simpler to just delete the old workspace from v13 and recreate on v14.

2 Likes

just add “[]” this will work… it means the workspace is parent and is not dependent on list.

In my case, this error is coming up on the CRM workspace. It was set to private after I migrated to V14 and i’m trying to set it back to public but I keep getting that error.

Does this essentially clear the contents of the workspace? I don’t want to use it on a standard workspace and risk breaking it.

UPDATE: I just decided to delete the CRM workspace and recreate it with identical data and I’m good now. Hoping that custom workspaces tied to standard modules don’t get deleted on bench update.

Correct, don’t use this on a standard workspace.
It’s only purpose is to fix v13 or earlier custom workspaces (which will not have any values in that column)

It turns out there is actually a patch that upgrades v1 workspaces to v2, it needed updating, which I did. But in their wisdom they refused to integrate it into the codebase, thus forcing everyone to recreate their own workspaces in v14. Go figure!

1 Like

How do i use this patch, please?

  • You would have to merge/rebase this patch into a new frappe branch of whatever version you are using
  • Ensure your v13 workspace still exists in the db
  • Run a migrate
  • Ensure developer mode is enabled
  • Save the workspace
  • Check the new workspace json file into your custom app

Hope that helps!

could you please elaborate a little bit more about the first step you mentioned?

@casesolved-co-uk please take a look at this, is there a patch for this?
I had to comment these

how can we extend a core workspace without modifying it directly or modifying the code. also, whenever i rearrange the workspaces the core workspaces file are changed as well which breaks the update as well