Skip to content

Commit b20dd9e

Browse files
committed
fix short name checks for regulation groups
1 parent c760651 commit b20dd9e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

arho_feature_template/gui/dialogs/plan_feature_form.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ def _check_regulation_group_short_names(self) -> bool:
114114
if not short_name:
115115
continue
116116

117-
if short_name in self.existing_group_short_names:
117+
if (
118+
not (
119+
reg_group_widget.regulation_group.id_ and short_name == reg_group_widget.regulation_group.short_name
120+
)
121+
and short_name in self.existing_group_short_names
122+
):
118123
existing_names.add(short_name)
119124
if short_name in seen_names:
120125
duplicate_names.add(short_name)

arho_feature_template/gui/dialogs/plan_regulation_group_form.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ def _initalize_regulation_from_config(self, config: RegulationConfig, parent: QT
145145

146146
def _check_short_name(self) -> bool:
147147
short_name = self.short_name.text()
148-
if short_name and short_name in self.existing_group_short_names:
148+
149+
if not short_name:
150+
return True
151+
if (
152+
not (self.regulation_group.id_ and short_name == self.regulation_group.short_name)
153+
and short_name in self.existing_group_short_names
154+
):
149155
msg = f"Kaavamääräysryhmä lyhyellä nimellä '<b>{short_name}</b>' on jo olemassa."
150156
QMessageBox.critical(self, "Virhe", msg)
151157
return False

0 commit comments

Comments
 (0)