Merge pull request #3356 from FinnStutzenstein/Issue3353

Clear the identifier_number on identifier reset (fixes #3353)
This commit is contained in:
Emanuel Schütze 2017-09-08 22:21:45 +02:00 committed by GitHub
commit 7eaa388747
2 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,7 @@ Motions:
- Added inline Editing for motion reason [#3361]. - Added inline Editing for motion reason [#3361].
- Added multiselect filter for motion comments [#3372]. - Added multiselect filter for motion comments [#3372].
- Added support for pinning personal notes to the window [#3360]. - Added support for pinning personal notes to the window [#3360].
- Clear identifier on state reset [#3356].
Elections: Elections:
- Added pagination for list view [#3393]. - Added pagination for list view [#3393].

View File

@ -581,13 +581,20 @@ class Motion(RESTModelMixin, models.Model):
def reset_state(self, workflow=None): def reset_state(self, workflow=None):
""" """
Set the state to the default state. Set the state to the default state. If an identifier was set
automatically, reset the identifier and identifier_number.
'workflow' can be a workflow, an id of a workflow or None. 'workflow' can be a workflow, an id of a workflow or None.
If the motion is new and workflow is None, it chooses the default If the motion is new and workflow is None, it chooses the default
workflow from config. workflow from config.
""" """
# The identifier is set automatically.
if config['motions_identifier'] is not 'manually':
self.identifier = ''
self.identifier_number = None
if type(workflow) is int: if type(workflow) is int:
workflow = Workflow.objects.get(pk=workflow) workflow = Workflow.objects.get(pk=workflow)