{
id: Id;
state_id: Id;
}The state_id must be a next or previous state as the current motions state, except if the request user has motion.can_manage_metadata, in which case all states of the same workflow are valid.
The field workflow_timestamp is set to the current timestamp if it is currently empty and the
new state has the set_workflow_timestamp flag.
The field number is potentially updated from the motion. This procedure diverges slightly from the motion.create one, but is essentially equal. Diverging steps are marked with CHANGED/NEW. This is the procedure to determine what to set for the field number:
- If the motion already has a non-empty
numberormeeting/motions_number_type=="manually"or notstate.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 already has a
number_value, choose it. (<-- NEW) - Else 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 motions. If there are no other motions, choose 1.
- If the motion already has a
- 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.
The request user needs to have motion.can_manage_metadata. Or he must be the submitter of the motion and the motion's state must have allow_submitter_edit set to true.