diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec57c0864..5e1430bc4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,14 +15,14 @@ Motions: - New possibility to sort submitters [#3647]. - New representation of amendments (paragraph based creation, new diff and list views for amendments) [#3637]. - - New feature to customize workflows and states [#3772]. + - New feature to customize workflows and states [#3772, #3785]. - New config options to show logos on the right side in PDF [#3768]. - New table of contents with page numbers and categories in PDF [#3766]. - New teporal field "modified final version" where the final version can be edited [#3781]. - New config to show amendments also in motions table [#3792] - Core: +Core: - Python 3.4 is not supported anymore [#3777]. - Support Python 3.7 [#3786]. - Updated pdfMake to 0.1.37 [#3766]. diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index 6f2791bc2..b62fef864 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -101,12 +101,11 @@ class WorkflowSerializer(ModelSerializer): Serializer for motion.models.Workflow objects. """ states = StateSerializer(many=True, read_only=True) - # The first_state is checked in the update() method - first_state = PrimaryKeyRelatedField(queryset=State.objects.all(), required=False) class Meta: model = Workflow fields = ('id', 'name', 'states', 'first_state',) + read_only_fields = ('first_state',) @transaction.atomic def create(self, validated_data): @@ -127,17 +126,6 @@ class WorkflowSerializer(ModelSerializer): workflow.save() return workflow - @transaction.atomic - def update(self, workflow, validated_data): - """ - Check, if the first state is in the right workflow. - """ - first_state = validated_data.get('first_state') - if first_state is not None: - if workflow.pk != first_state.workflow.pk: - raise ValidationError({'detail': 'You cannot select a state which is not in the workflow as the first state.'}) - return super().update(workflow, validated_data) - class MotionCommentsJSONSerializerField(Field): """ diff --git a/openslides/motions/static/js/motions/base.js b/openslides/motions/static/js/motions/base.js index d2741bb4c..b8986e3b1 100644 --- a/openslides/motions/static/js/motions/base.js +++ b/openslides/motions/static/js/motions/base.js @@ -54,7 +54,7 @@ angular.module('OpenSlidesApp.motions', [ name: 'motions/workflow', methods: { getFirstState: function () { - return DS.get('motions/state', this.first_state); + return DS.get('motions/state', this.first_state_id); }, }, relations: { diff --git a/openslides/motions/static/js/motions/workflow.js b/openslides/motions/static/js/motions/workflow.js index 2d3cad8e0..db22d55aa 100644 --- a/openslides/motions/static/js/motions/workflow.js +++ b/openslides/motions/static/js/motions/workflow.js @@ -120,13 +120,6 @@ angular.module('OpenSlidesApp.motions.workflow', []) }); }; - $scope.setFirstState = function (state) { - $scope.workflow.first_state = state.id; - Workflow.save($scope.workflow).then(null, function (error) { - $scope.alert = ErrorMessage.forAlert(error); - }); - }; - // Save expand state so the session if ($sessionStorage.motionStateTableExpandState) { $scope.toggleExpandContent(); diff --git a/openslides/motions/static/templates/motions/workflow-detail.html b/openslides/motions/static/templates/motions/workflow-detail.html index 77452a0f0..29c8da0ca 100644 --- a/openslides/motions/static/templates/motions/workflow-detail.html +++ b/openslides/motions/static/templates/motions/workflow-detail.html @@ -24,22 +24,9 @@