(self, module)
return action
Returns registration/followup form action
Returns registration/followup form action
Returns registration / followup form action
def _get_case_list_form_action(self, module):
        """
        Returns registration/followup form action
        """
        form = self.app.get_form(module.case_list_form.form_id)

        if self.app.enable_localized_menu_media:
            case_list_form = module.case_list_form
            action = LocalizedAction(
                menu_locale_id=id_strings.case_list_form_locale(module),
                media_image=case_list_form.uses_image(build_profile_id=self.build_profile_id),
                media_audio=case_list_form.uses_audio(build_profile_id=self.build_profile_id),
                image_locale_id=id_strings.case_list_form_icon_locale(module),
                audio_locale_id=id_strings.case_list_form_audio_locale(module),
                stack=Stack(),
                for_action_menu=True,
            )
        else:
            action = Action(
                display=Display(
                    text=Text(locale_id=id_strings.case_list_form_locale(module)),
                    media_image=module.case_list_form.default_media_image,
                    media_audio=module.case_list_form.default_media_audio,
                ),
                stack=Stack(),
            )

        action_relevant = module.case_list_form.relevancy_expression
        if toggles.FOLLOWUP_FORMS_AS_CASE_LIST_FORM.enabled(self.app.domain) and action_relevant:
            action.relevant = action_relevant

        frame = PushFrame()
        frame.add_command(XPath.string(id_strings.form_command(form)))

        target_form_dm = self.entries_helper.get_datums_meta_for_form_generic(form)
        source_form_dm = []
        if len(module.forms):
            source_form_dm = self.entries_helper.get_datums_meta_for_form_generic(module.get_form(0))
        for target_meta in target_form_dm:
            if target_meta.requires_selection:
                # This is true for registration forms where the case being created is a subcase
                try:
                    [source_dm] = [
                        source_meta for source_meta in source_form_dm
                        if source_meta.case_type == target_meta.case_type
                    ]
                except ValueError:
                    pass
                else:
                    frame.add_datum(StackDatum(
                        id=target_meta.datum.id,
                        value=session_var(source_dm.datum.id))
                    )
            else:
                s_datum = target_meta.datum
                frame.add_datum(StackDatum(id=s_datum.id, value=s_datum.function))

        frame.add_datum(StackDatum(id=RETURN_TO, value=XPath.string(id_strings.menu_id(module))))
        action.stack.add_frame(frame)
        return action
def _get_case_list_form_action ( self , module ) : form = self . app . get_form ( module . case_list_form . form_id ) if self . app . enable_localized_menu_media : case_list_form = module . case_list_form action = LocalizedAction ( menu_locale_id = id_strings . case_list_form_locale ( module ) , media_image = case_list_form . uses_image ( build_profile_id = self . build_profile_id ) , media_audio = case_list_form . uses_audio ( build_profile_id = self . build_profile_id ) , image_locale_id = id_strings . case_list_form_icon_locale ( module ) , audio_locale_id = id_strings . case_list_form_audio_locale ( module ) , stack = Stack ( ) , for_action_menu = True , ) else : action = Action ( display = Display ( text = Text ( locale_id = id_strings . case_list_form_locale ( module ) ) , media_image = module . case_list_form . default_media_image , media_audio = module . case_list_form . default_media_audio , ) , stack = Stack ( ) , ) action_relevant = module . case_list_form . relevancy_expression if toggles . FOLLOWUP_FORMS_AS_CASE_LIST_FORM . enabled ( self . app . domain ) and action_relevant : action . relevant = action_relevant frame = PushFrame ( ) frame . add_command ( XPath . string ( id_strings . form_command ( form ) ) ) target_form_dm = self . entries_helper . get_datums_meta_for_form_generic ( form ) source_form_dm = [ ] if len ( module . forms ) : source_form_dm = self . entries_helper . get_datums_meta_for_form_generic ( module . get_form ( 0 ) ) for target_meta in target_form_dm : if target_meta . requires_selection : # This is true for registration forms where the case being created is a subcase try : [ source_dm ] = [ source_meta for source_meta in source_form_dm if source_meta . case_type == target_meta . case_type ] except ValueError : pass else : frame . add_datum ( StackDatum ( id = target_meta . datum . id , value = session_var ( source_dm . datum . id ) ) ) else : s_datum = target_meta . datum frame . add_datum ( StackDatum ( id = s_datum . id , value = s_datum . function ) ) frame . add_datum ( StackDatum ( id = RETURN_TO , value = XPath . string ( id_strings . menu_id ( module ) ) ) ) action . stack . add_frame ( frame ) return action