From 7c6e98fae6c0ab842e18ac80c517aebc5c03eb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 19 Jan 2019 22:36:31 +0100 Subject: [PATCH] Fixed following recommendations with extensions. --- openslides/motions/models.py | 4 ++++ openslides/motions/views.py | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 29efe2159..60e9a15dc 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -507,6 +507,10 @@ class Motion(RESTModelMixin, models.Model): """ if self.recommendation is not None: self.set_state(self.recommendation) + if (self.recommendation_extension is not None + and self.state.show_state_extension_field + and self.recommendation.show_recommendation_extension_field): + self.state_extension = self.recommendation_extension """ Container for runtime information for agenda app (on create or update of this instance). diff --git a/openslides/motions/views.py b/openslides/motions/views.py index 289427317..673ac1818 100644 --- a/openslides/motions/views.py +++ b/openslides/motions/views.py @@ -827,13 +827,7 @@ class MotionViewSet(ModelViewSet): if motion.recommendation is None: raise ValidationError({"detail": "Cannot set an empty recommendation."}) - # Set state. - motion.set_state(motion.recommendation) - - # Set the special state comment. - extension = request.data.get("state_extension") - if extension is not None: - motion.state_extension = extension + motion.follow_recommendation() # Save and write log. motion.save(