generated from dopt-python/py311
custom logic for 'Aufenthaltsort' and 'Bundesland'
This commit is contained in:
@@ -77,6 +77,7 @@ DEBUG_SEARCH_WIDGET: bool = False
|
||||
DEBUG_NO_DATABASE: bool = False
|
||||
DEBUG_GET_SET: bool = False
|
||||
|
||||
# fallback if deployed: disable all debug flags
|
||||
if not wce_crm.constants.Config.DEVELOPMENT_STATE:
|
||||
DEBUG = False
|
||||
DEBUG_SEARCH_WIDGET = False
|
||||
@@ -2909,10 +2910,7 @@ FORM_FIELDS_MASTER_DATA = [
|
||||
key="bundesland",
|
||||
required=False,
|
||||
options=GERMAN_STATE_LIST.for_dropdown,
|
||||
tooltip=(
|
||||
"nur wenn Inland angegeben und die Angabe zieht es in keine Dokumente "
|
||||
"rüber! Liste Bundesländer verwenden"
|
||||
),
|
||||
tooltip=("nur wenn Inland angegeben"),
|
||||
),
|
||||
FormField(
|
||||
"Land",
|
||||
@@ -3290,28 +3288,6 @@ FORM_FIELDS_LANGUAGES = [
|
||||
),
|
||||
],
|
||||
),
|
||||
# FormField(
|
||||
# "Nachweis",
|
||||
# FormFieldType.DROPDOWN,
|
||||
# required=False,
|
||||
# key="SP_nachweis",
|
||||
# options=[
|
||||
# ("vorhanden", None),
|
||||
# ("nicht vorhanden", None),
|
||||
# ],
|
||||
# ),
|
||||
# FormField(
|
||||
# "Art des Nachweises (NUR WENN VORHANDEN)",
|
||||
# FormFieldType.TEXT,
|
||||
# required=False,
|
||||
# key="SP_art_nachweis",
|
||||
# ),
|
||||
# FormField(
|
||||
# "Datum des Nachweises (NUR WENN VORHANDEN)",
|
||||
# FormFieldType.DATE,
|
||||
# required=False,
|
||||
# key="SP_datum_nachweis",
|
||||
# ),
|
||||
]
|
||||
|
||||
|
||||
@@ -3513,14 +3489,47 @@ class PageFormCompany(QWidget):
|
||||
container_layout.addSpacing(20)
|
||||
# title = QLabel("--- Automatische Form ---")
|
||||
# title.setStyleSheet("font-size: 14px; font-style: italic;") # font-weight: bold;
|
||||
# container_layout.addWidget(title)
|
||||
# container_layout.addWidget(MyFormPart(FORM_FIELD_DEF, "Test-Gruppe"))
|
||||
self.auto_form = AutoForm(cfg=CONFIG_GRUNDERFASSUNG_UNTERNEHMEN)
|
||||
container_layout.addWidget(self.auto_form)
|
||||
self.auto_form.save_clicked_form.connect(lambda: self.save_clicked_form.emit())
|
||||
|
||||
container_layout.addSpacing(30)
|
||||
|
||||
# --- CUSTOM LOGIC ---
|
||||
# 'Bundesland' only if 'Inland' selected in 'Stammdaten'
|
||||
person_location = search_widgets_by_key(
|
||||
self.auto_form.widget_registry, f"Stammdaten{COLUMN_SEP}aufenthaltsort"
|
||||
)
|
||||
assert len(person_location) == 1
|
||||
self.person_location = cast(QComboBox, person_location[0]["widget"])
|
||||
assert isinstance(self.person_location, QComboBox)
|
||||
self.person_location.currentIndexChanged.connect(self._custom_county_selection)
|
||||
|
||||
selection_county = search_widgets_by_key(
|
||||
self.auto_form.widget_registry, f"Stammdaten{COLUMN_SEP}bundesland"
|
||||
)
|
||||
assert len(selection_county) == 1
|
||||
self.selection_county = cast(QComboBox, selection_county[0]["widget"])
|
||||
assert isinstance(self.selection_county, QComboBox)
|
||||
self.selection_county.setProperty("styleClass", "stempel")
|
||||
self.selection_county.setEnabled(False)
|
||||
|
||||
def _custom_county_selection(self, idx: int) -> None:
|
||||
value = self.person_location.itemData(idx)
|
||||
if value == "Inland":
|
||||
self.selection_county.setEnabled(True)
|
||||
self.selection_county.setProperty("styleClass", "")
|
||||
self.selection_county.style().unpolish(self.selection_county)
|
||||
self.selection_county.style().polish(self.selection_county)
|
||||
self.selection_county.update()
|
||||
else:
|
||||
self.selection_county.setCurrentIndex(0)
|
||||
self.selection_county.setEnabled(False)
|
||||
self.selection_county.setProperty("styleClass", "stempel")
|
||||
self.selection_county.style().unpolish(self.selection_county)
|
||||
self.selection_county.style().polish(self.selection_county)
|
||||
self.selection_county.update()
|
||||
|
||||
def reset_form(self) -> None:
|
||||
self.auto_form.reset_form()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user