{
// Required
title: string;
meeting_id: Id;
// Optional
number: string;
additional_submitter: string;
sort_parent_id: Id;
category_id: Id;
block_id: Id;
supporter_meeting_user_ids: Id[]; // meeting user ids
tag_ids: Id[];
attachment_mediafile_ids: Id[];
// Special logic given by the type of the motion
text: HTML;
amendment_paragraph: {
[paragraph_number: number]: HTML;
}; // JSON Field
lead_motion_id: Id;
reason: HTML; // is required, if special settings are set
// Optional special fields, see notes below
workflow_id: Id;
submitter_meeting_user_ids: Id[];
// Non-model fields for customizing the agenda item creation, optional
agenda_create: boolean;
agenda_type: number;
agenda_parent_id: number;
agenda_comment: string;
agenda_duration: number;
agenda_weight: number;
agenda_tag_ids: Id[];
}Creates a new motion.
The motion is an amendment to another motion if lead_motion_id is given. Otherwise it is a normal motion.
This is the logic for other fields depending on the motion type:
- normal motion:
textrequired- error, if
amendment_paragraphis given
- amendment:
textXORamendment_paragraphrequired- error otherwise
reason must independently of the above be given, if meeting/motions_reason_required is true.
There are some fields that need special attention:
workflow_id: If it is given, the motion's state is set to the workflow's first state. The workflow must be from the same meeting. If the field is not given, one of the three default (meeting/motions_default_workflow_idormeeting/motions_default_amendment_workflow_id) workflows is used depending on the type of the motion to create.additional_submittera text field where text-based submitter information may be entered. Cannot be set unlessmeeting/motions_create_enable_additional_submitter_textistrue. Requires permissionsMotion.CAN_CREATEandMotion.CAN_MANAGE_METADATA.submitter_meeting_user_ids: These are ids of the meeting users that should get amotion_submittermodel. Can be left empty. The weight of the new submitters is set to the order of the given list. Requires permissionsMotion.CAN_CREATE,Motion.CAN_MANAGE_METADATAandUser.CAN_SEE(the latter two only if not setting oneself).agenda_*: See Agenda.
Other things to do when creating motions:
- Set timestamps:
- always set
last_modifiedandcreatedto the current timestamp - if the state pointed to by
first_state_idof the given workflow has the flagset_workflow_timestampset, also setworkflow_timestampto the current timestamp.
- always set
- Field
number: Attention, it is a string, even if the field is namednumber. Note that thenumbermust be unique within the meeting if it is set (so all numbers with length > 0 are unique). See the next paragraph how to get a value fornumber.
This is the procedure to determine what to set for the field number:
- If
numberin the payload is a string with a length > 0, set it as the number and stop, but raise an error, if it exists. - If
meeting/motions_number_type=="manually"or notmotion.state.set_number: stop. We should not set the number automatically - A prefix is created:
- If the motion is an amendment (it has a lead motion), the prefix is:
if meeting/motions_number_with_blank: prefix = f"{lead_motion.number} {meeting/motions_amendments_prefix}" else: prefix = f"{lead_motion.number}{meeting/motions_amendments_prefix}" - Else if the motion has a category, the prefix is:
if meeting/motions_number_with_blank: prefix = f"{category.prefix} " else: prefix = f"{category.prefix}" - Else, the prefix is an empty string
- If the motion is an amendment (it has a lead motion), the prefix is:
- choose a number_value. This is a numerical variable with the actual numerical number:
- If the motion is an amendment (it has a lead motion),
number_valueis the maximum+1 ofnumber_valueof all lead_motion.amendments. If there are no other amendments,number_valueis 1. Hint: To easily access thenumber_valueof other motions, it can be saved into the Datastore. - Else if
meeting/motions_number_typeis"per_category", choose the maximum+1 ofnumber_valueof all motions in the motions category. This includes the "None"-category; if the motion has no category, the maximum is choosen of all motions, that do not have a category. If there are no other motions,number_valueis 1. - Else: Choose the maximum+1 of
number_valueof all lead motions. If there are no other lead motions, choose 1.
- If the motion is an amendment (it has a lead motion),
- create
numberfromprefixandnumber_value:- First,
number_valueis converted to the stringnumber_value_stringand potentially filled with leading zeros. The valuemeeting/motions_number_min_digitsgives the amount of minimum digits. E.g. ifnumber_valueis 12 andmeeting/motions_number_min_digits=3, thenumber_value_stringis"012". Ifnumber_valueis 3582, thenumber_value_stringis"3582". - Set
number = f"{prefix}{number_value_string}"
- First,
- Remember:
numbermust be unique. If a motion with this number already exists, incrementnumber_valueby one and go to the last step (the prefix is the same, the number incremented - try again). - If there is a unique
number, save it into the motion. Done! - Note: The complete calculation is restricted to motions and other objects from the same meeting.
Some examples for determinating the number. First comes the general setup and the test cases are numbered:
meeting/motions_number_type="manually"
- Create a motion without a number in the payload. It now has a blank one.
- Create two motion without a number in the payload. Both have a blank one.
- Create two motion with the same number in the payload. The second one fails since numbers must be unique.
meeting/motions_number_type="serially_numbered", meeting/motions_number_min_digits=3, meeting/motions_number_with_blank=true. Create three categories: {name: "A", prefix: "A"}, {name: "B", prefix: "B"}, {name: "no prefix"} (the last one has an empty prefix, see OpenSlides/OpenSlides#5723). Make sure the state the motions get has set_number=true.
- Create three motions with no number in the payloads and each motion assigned to one category in the order A, B, no prefix. The resulting numbers should be
A 001,B 002,003. - Create a motion with category A, it should get
A 001. Create a second motion with the numberB 002in the payload. Create a third motion with category B and no number in the payload. It must get the numberB 003. - Create a motion in category A. It must get
A 001. Delete it and create a new motion in category A. It should also getA 001.
meeting/motions_number_type="per_category", meeting/motions_number_min_digits=3, meeting/motions_number_with_blank=false. Create three categories: {name: "A", prefix: "A"}, {name: "B", prefix: "B"}, {name: "no prefix"}. Make sure the state the motions get has set_number=true.
- Create two motions in category A. Than two motions in category B. Than two motions in category
no prefix. The numbers must beA001,A002,B001,B002,001and002. - Create a motion without a category. It gets the number
001. Setmeeting/motions_number_min_digits=1. Create a plain motion. It must get the number2.
meeting/motions_number_type="per_category", meeting/motions_number_min_digits=3, meeting/motions_number_with_blank=true, meeting/motions_amendments_prefix="X-". Create a category: {name: "A", prefix: "A"}. Make sure the state the motions get has set_number=true.
- Create a motion in category A. It must get
A 001. Create two amendments (motions withlead_motion_idset to the id ofA 001). The numbers areA 001 X-001andA 001 X-002. - Do 1) again, but with
meeting/motions_number_with_blank=falseandmeeting/motions_number_min_digits=1. The numbers areA1,A1X-1,A1X-2. - Do 1) again, but set
meeting/motions_number_with_blank=falseandmeeting/motions_number_min_digits=1after creating the first lead motion. The numbers areA 001,A 001X-1,A 001X-2. - Do 1) again. Create a new motion without an identifier and no
lead_motion_id. It gets the number002.
Repeat an autonumbering task from above, but set the states set_number=false. The motions should not get a number and have a blank one, if it was not provided in the payload.
The request user needs:
motion.can_manageif he has his vote delegated and the meeting hasusers_forbid_delegator_as_submittermotion.can_create_amendmentsiflead_motion_idis givenmotion.can_createelse
If the request user does not have motion.can_manage, the fields in the payload are restricted with a whitelist. These fields are contained:
meeting_idtitletextreasonlead_motion_idamendment_paragraphcategory_idworkflow_id
If lead_motion_id is given and category_id is empty, the value of category_id is set to the value of the lead motion.