Merge pull request #4421 from MaximilianKrambach/setMultiStateFix

fix identifier setting on mass setstate
This commit is contained in:
Emanuel Schütze 2019-02-27 22:31:18 +01:00 committed by GitHub
commit e59327efd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -666,9 +666,18 @@ class MotionViewSet(ModelViewSet):
{"detail": f"You can not set the state to {state_id}."}
)
motion.set_state(state_id)
state = State.objects.get(pk=state_id)
# Save motion.
motion.save(update_fields=["state", "last_modified"], skip_autoupdate=True)
if not state.dont_set_identifier:
motion.save(
update_fields=["state", "last_modified", "identifier"],
skip_autoupdate=True,
)
else:
motion.save(
update_fields=["state", "last_modified"], skip_autoupdate=True
)
# Write the log message.
motion.write_log(