def _handle_subcase_actions(self, actions): active_actions = [a for a in actions if a.is_active()] for action in active_actions: sub_type_meta = self.meta.get_type(action.case_type) sub_type_meta.add_opener(self.form.unique_id, action.condition) if action.close_condition.is_active(): sub_type_meta.add_closer(self.form.unique_id, action.close_condition) for name, question_path in FormAction.get_action_properties(action): self._add_property_save(action.case_type, name, question_path)
def generate_paths(): from corehq.apps.app_manager.models import FormAction for action in self.form.active_actions().values(): if isinstance(action, list): actions = action else: actions = [action] for action in actions: for path in FormAction.get_action_paths(action): yield path
def _handle_subcase_actions(self, actions): active_actions = [a for a in actions if a.is_active()] for action in active_actions: sub_type_meta = self.meta.get_type(action.case_type) sub_type_meta.add_opener(self.form.unique_id, action.condition) if action.close_condition.is_active(): sub_type_meta.add_closer(self.form.unique_id, action.close_condition) for name, question_path in FormAction.get_action_properties( action): self._add_property_save(action.case_type, name, question_path)
def test_close_case(self): self.form.requires = 'case' self.form.actions.close_case = FormAction() self.form.actions.close_case.condition.type = 'always' self.assertXmlEqual(self.get_xml('close_case'), self.form.render_xform())
def _handle_load_action(self, action_type, action): case_type = USERCASE_TYPE if action_type == 'usercase_update' else self.case_type for name, question_path in FormAction.get_action_properties(action): self._add_property_load(case_type, name, question_path)
def test_close_case(self): self.form.requires = 'case' self.form.actions.close_case = FormAction() self.form.actions.close_case.condition.type = 'always' check_xml_line_by_line(self, self.get_xml('close_case'), self.form.render_xform())