open_module_for_parents
: This method opens the assignment module and should also do some checks: check_for_assignment_data
None
should be returned and if the show_messages
parameter is set it should also give a proper error message
is_assigned
: This method is necessary to check if a assignment already exists and needs to be implemented for each assignment individually
id_field_py_id
: This property should return the data field python id of the ID field by which a source record can be unambiguously identified, in the example bellow this is the project id
class PortfolioWatchlistAssignmentModule(AssignmentModuleBase): @property def no_data_available_message_id(self): return '1195' @classmethod def open_module_for_parents(cls, parents=None, show_messages=True, **kwargs): if parents and not isinstance(parents, list): parents = [parents] mod_obj = ppms.get_target_module() target = get_global_setting_value('edit_portfolio_watchlist', 'alpha120') with ppms.echo_disabled(): target_mod_obj = mod_obj.open_module(target) target_mod_obj.set_current_L_var(16, parents) target_mod_obj.menu(MENU_FILTER) if not target_mod_obj.check_for_assignment_data(show_messages=show_messages): target_mod_obj.menu(MENU_CLOSE) return None return target_mod_obj @property def id_field_py_id(self): return 'pr_id' @staticmethod def is_assigned(parent_id, child_id): user = ppms.uvar_get('@1') assignment_record = ppms.search_record(534, [child_id, parent_id, user], ['uuid']) return bool(assignment_record)
def di065272_chosen_for_assignment_radio_checkInput(di, oldvalue): """This value range simulates a radio button.""" records = di.get_dfs()[0].get_record().get_da().get_records() for record in records: if record.chosen_for_assignment_radio.get_raw_value(): record.chosen_for_assignment_radio.set_raw_value(0) return di.get_value() di065272_chosen_for_assignment_radio_checkInput.deps = ("",)
get_source_records
method.
The method should return an iterable of all mts records which are marked in the source area. ids
. If you want to use the static method for assigning records, you have to make sure that all source records with ids within the ids
list are also returned. The key field for the comparision is defined in the property id_field_py_id
.
Function | Parameters | Return Value | Description |
---|---|---|---|
AssignmentModuleBase.after_insert(self) |
Is called after all inserts are done. Used to close the module and filter in the invoker module to show the new assignment data | ||
AssignmentModuleBase.assign_marked_records(self, applied_dfc, clicked_df) |
applied_dfc: Applied datafield customizing clicked_df: The clicked DF |
The method which is called when pressing the assignment button. Invokes the creation of new assignments | |
AssignmentModuleBase.check_for_assignment_data(self, show_messages=True) |
show_messages: Whether a message box that there is no assignment data should be shown | True when assignment data is available, False otherwise |
This method should be called in the open_module_for_parents method |
AssignmentModuleBase.click_assignment_button(self) |
Programatic way of clicking the assignment button. Used in regression tests | ||
AssignmentModuleBase.get_parent_records(self) |
All parent records in the module | ||
AssignmentModuleBase.get_source_records(self, ids=None) |
ids: Can be used to retrieve all source records with the given IDs | List of all marked source records as mts_record |
Used to retrieve all relevant source records which need to be assigned |
AssignmentModuleBase.get_value_from_source_or_parent(self, parent_mts_record, source_mts_record, df_python_id) |
parent_mts_record: The parent mts record of the assignment source_mts_record: The source (child) mts record df_python_id: The datafield id of the new assignment record, there needs to be a DF with the same ID in the parent or source area |
The value for the given df python id | |
AssignmentModuleBase.insert_into_assignment_table(self, parent_mts_record, source_mts_record) |
parent_mts_record: Parent mts record of the new assignment source_mts_record: The child mts record of the new assignment |
The new assignment mts record |
Creates and fills the new assignment record, also saves the record if possible |
AssignmentModuleBase.on_load(self) |
Filters and resets all checkboxes so nothing is checked when the module is opened | ||
AssignmentModuleBase.reset_dummy_record_checkbox(self) |
Resets all checkboxes |
Function | Parameters | Return Value | Description |
---|---|---|---|
AssignmentModuleBase.assign_children_to_parent(cls, children_ids, parent_id, **kwargs) |
children_ids: The ID of the child record to assign parent_id: The ID of the parent record kwargs: Special properties needed for some assingments, defined in the child classes |
A static method to assign children records to a parent | |
AssignmentModuleBase.open_module_for_parents(cls, parents=None, show_messages=False, **kwargs) |
parents: The parent ids for which the module is opened show_messages: Whether error messages should be shown kwargs: Special parameters used in some assignment modules |
The module or None if there is no assignment data available |
Needed in every assignment module, is e.g. also used for the static assignment method |
Function | Parameters | Return Value | Description |
---|---|---|---|
AssignmentModuleBase.get_all_dfs_from_area(mts_record) |
mts_record: mts record |
Returns a list of all df python ids in the record | |
AssignmentModuleBase.is_assigned(parent_id, child_id) |
parent_id: ID of the parent record child_id: ID of the child record |
True or False |
Property | Getter | Setter | Description |
---|---|---|---|
AssignmentModuleBase.assignment_button_da_id | The data area python ID where the assignment button is located | ||
AssignmentModuleBase.assignment_data_area | The data area python ID of the data area where the new assignment record is inserted | ||
AssignmentModuleBase.button_df_id | The button data field ID of the assignment button | ||
AssignmentModuleBase.checkbox_python_id | The python ID of the checkbox to mark source records | ||
AssignmentModuleBase.id_field_py_id | The datafield python ID with which source records can be identified | ||
AssignmentModuleBase.no_data_available_message_id | The message ID which is displayed when | ||
AssignmentModuleBase.parent_data_areas | List of data areas where the data area python id starts with "parent" | ||
AssignmentModuleBase.source_data_areas | List of data areas where the data area python id starts with "source" |
Property | Getter | Setter | Description |
---|---|---|---|
RadiobuttonAssignmentModuleBase.checkbox_python_id | Datafield python id of the radio button |
Function | Parameters | Return Value | Description |
---|---|---|---|
StakeholderAssignmentModuleBase.stakeholder_exists(member_id=None) |
member_id: Member ID of the stakeholder | True or False |
Check if a stakeholder record exists, needed for some assignments |
I | Attachment | History | Size | Date | Comment |
---|---|---|---|---|---|
png | assignmentarea.png | r1 | 15.3 K | 2019-04-17 - 09:07 | |
png | modulcustomizing.png | r1 | 6.9 K | 2019-04-16 - 14:57 |