Skip to content

Commit 1a9f19f

Browse files
committed
Add organisation to the plan form
1 parent 49d20b1 commit 1a9f19f

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

arho_feature_template/gui/plan_attribure_form.py

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from arho_feature_template.core.models import Plan
1010
from arho_feature_template.project.layers.code_layers import (
1111
LifeCycleStatusLayer,
12+
OrganisationLayer,
1213
PlanTypeLayer,
1314
)
1415

@@ -24,6 +25,7 @@
2425
class PlanAttributeForm(QDialog, FormClass): # type: ignore
2526
permanent_identifier_line_edit: QLineEdit
2627
name_line_edit: QLineEdit
28+
organisation_combo_box: CodeComboBox
2729
description_text_edit: QTextEdit
2830
plan_type_combo_box: HierarchicalCodeComboBox
2931
lifecycle_status_combo_box: CodeComboBox
@@ -38,13 +40,15 @@ def __init__(self, parent=None):
3840

3941
self.plan_type_combo_box.populate_from_code_layer(PlanTypeLayer)
4042
self.lifecycle_status_combo_box.populate_from_code_layer(LifeCycleStatusLayer)
43+
self.organisation_combo_box.populate_from_code_layer(OrganisationLayer)
4144

4245
def get_plan_attributes(self) -> Plan:
4346
return Plan(
4447
id_=None,
4548
name=self.name_line_edit.text(),
4649
description=self.description_text_edit.toPlainText() or None,
4750
plan_type_id=self.plan_type_combo_box.value(),
51+
organisation_id=self.organisation_combo_box.value(),
4852
permanent_plan_identifier=self.permanent_identifier_line_edit.text() or None,
4953
record_number=self.record_number_line_edit.text() or None,
5054
producers_plan_identifier=self.producers_plan_identifier_line_edit.text() or None,

arho_feature_template/gui/plan_attribute_form.ui

+26-17
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<rect>
1010
<x>0</x>
1111
<y>0</y>
12-
<width>537</width>
13-
<height>350</height>
12+
<width>535</width>
13+
<height>343</height>
1414
</rect>
1515
</property>
1616
<property name="windowTitle">
@@ -61,8 +61,8 @@
6161
<rect>
6262
<x>0</x>
6363
<y>0</y>
64-
<width>507</width>
65-
<height>271</height>
64+
<width>505</width>
65+
<height>264</height>
6666
</rect>
6767
</property>
6868
<layout class="QVBoxLayout" name="verticalLayout_4">
@@ -97,7 +97,7 @@
9797
<item row="1" column="0">
9898
<widget class="QLabel" name="nimiLabel">
9999
<property name="text">
100-
<string>Nimi:</string>
100+
<string>Nimi*:</string>
101101
</property>
102102
<property name="buddy">
103103
<cstring>name_line_edit</cstring>
@@ -128,40 +128,50 @@
128128
</property>
129129
</widget>
130130
</item>
131-
<item row="3" column="0">
131+
<item row="4" column="0">
132132
<widget class="QLabel" name="tyyppiLabel">
133133
<property name="text">
134-
<string>Kaavalaji:</string>
134+
<string>Kaavalaji*:</string>
135135
</property>
136136
<property name="buddy">
137137
<cstring>plan_type_combo_box</cstring>
138138
</property>
139139
</widget>
140140
</item>
141-
<item row="3" column="1">
141+
<item row="4" column="1">
142142
<widget class="HierarchicalCodeComboBox" name="plan_type_combo_box">
143143
<property name="toolTip">
144144
<string>Kaava-asian kaavalaji</string>
145145
</property>
146146
</widget>
147147
</item>
148-
<item row="4" column="0">
148+
<item row="5" column="0">
149149
<widget class="QLabel" name="elinkaarenTilaLabel">
150150
<property name="text">
151-
<string>Elinkaaren tila:</string>
151+
<string>Elinkaaren tila*:</string>
152152
</property>
153153
<property name="buddy">
154154
<cstring>lifecycle_status_combo_box</cstring>
155155
</property>
156156
</widget>
157157
</item>
158-
<item row="4" column="1">
158+
<item row="5" column="1">
159159
<widget class="CodeComboBox" name="lifecycle_status_combo_box">
160160
<property name="toolTip">
161161
<string>Kaavan elinkaaren tila</string>
162162
</property>
163163
</widget>
164164
</item>
165+
<item row="3" column="0">
166+
<widget class="QLabel" name="label_5">
167+
<property name="text">
168+
<string>Organisaatio*:</string>
169+
</property>
170+
</widget>
171+
</item>
172+
<item row="3" column="1">
173+
<widget class="CodeComboBox" name="organisation_combo_box"/>
174+
</item>
165175
</layout>
166176
</item>
167177
<item>
@@ -248,8 +258,8 @@
248258
<rect>
249259
<x>0</x>
250260
<y>0</y>
251-
<width>507</width>
252-
<height>271</height>
261+
<width>505</width>
262+
<height>264</height>
253263
</rect>
254264
</property>
255265
</widget>
@@ -260,7 +270,7 @@
260270
</widget>
261271
</item>
262272
<item>
263-
<widget class="QDialogButtonBox" name="buttonBox">
273+
<widget class="QDialogButtonBox" name="button_box">
264274
<property name="orientation">
265275
<enum>Qt::Horizontal</enum>
266276
</property>
@@ -292,7 +302,6 @@
292302
<tabstops>
293303
<tabstop>tabWidget</tabstop>
294304
<tabstop>general_info_scroll_area</tabstop>
295-
<tabstop>permanent_identifier_line_edit</tabstop>
296305
<tabstop>name_line_edit</tabstop>
297306
<tabstop>description_text_edit</tabstop>
298307
<tabstop>plan_type_combo_box</tabstop>
@@ -305,7 +314,7 @@
305314
<resources/>
306315
<connections>
307316
<connection>
308-
<sender>buttonBox</sender>
317+
<sender>button_box</sender>
309318
<signal>accepted()</signal>
310319
<receiver>Dialog</receiver>
311320
<slot>accept()</slot>
@@ -321,7 +330,7 @@
321330
</hints>
322331
</connection>
323332
<connection>
324-
<sender>buttonBox</sender>
333+
<sender>button_box</sender>
325334
<signal>rejected()</signal>
326335
<receiver>Dialog</receiver>
327336
<slot>reject()</slot>

arho_feature_template/project/layers/code_layers.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ class LifeCycleStatusLayer(AbstractCodeLayer):
1414
name = "Elinkaaren tila"
1515

1616

17+
class OrganisationLayer(AbstractCodeLayer):
18+
name = "Toimija"
19+
20+
1721
code_layers = AbstractCodeLayer.__subclasses__()

0 commit comments

Comments
 (0)