diff --git a/oarepo_requests/types/generic.py b/oarepo_requests/types/generic.py index 85e1bb9f..ff0d503b 100644 --- a/oarepo_requests/types/generic.py +++ b/oarepo_requests/types/generic.py @@ -18,7 +18,6 @@ class OARepoRequestType(RequestType): description = None dangerous = False - editable = True @classmethod @property @@ -30,6 +29,11 @@ def available_statuses(cls): def has_form(cls): return hasattr(cls, "form") + @classmethod + @property + def editable(cls): + return cls.has_form + def can_create(self, identity, data, receiver, topic, creator, *args, **kwargs): current_requests_service.require_permission( identity, "create", record=topic, request_type=self, **kwargs diff --git a/setup.cfg b/setup.cfg index 5ae9bf95..c24c5be7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-requests -version = 2.2.1 +version = 2.2.2 description = authors = Ronald Krist readme = README.md diff --git a/tests/test_requests/test_allowed_request_types_link_and_service.py b/tests/test_requests/test_allowed_request_types_link_and_service.py index 2d9b6a14..105017f4 100644 --- a/tests/test_requests/test_allowed_request_types_link_and_service.py +++ b/tests/test_requests/test_allowed_request_types_link_and_service.py @@ -234,7 +234,7 @@ def test_ui_serialization( { "dangerous": True, "description": "Request deletion of draft", - "editable": True, + "editable": False, "has_form": False, "links": { "actions": { @@ -279,7 +279,7 @@ def test_ui_serialization( "description": "Request deletion of published record", "name": "Delete record", "dangerous": True, - "editable": True, + "editable": False, "has_form": False, "stateful_description": "Request permission to delete the record.", "stateful_name": "Request record deletion", @@ -294,7 +294,7 @@ def test_ui_serialization( "description": "Request re-opening of published record", "name": "Edit record", "dangerous": False, - "editable": True, + "editable": False, "has_form": False, "stateful_description": "Click to start editing the metadata of the record.", "stateful_name": "Edit record", @@ -309,7 +309,7 @@ def test_ui_serialization( "description": "Request requesting creation of new version of a published record.", "name": "New Version", "dangerous": False, - "editable": True, + "editable": False, "has_form": False, "stateful_description": "Click to start creating a new version of the " "record.",