summaryrefslogtreecommitdiff
path: root/supportive_help
diff options
context:
space:
mode:
authorOsCoder <oscoder@lczimmermann.eu>2026-03-17 22:43:08 +0000
committerOsCoder <oscoder@lczimmermann.eu>2026-03-17 22:43:08 +0000
commita6f33efee363f6308658325da418571f3156208f (patch)
treec8e29225eddf4037f6bb59757733a7674983aea2 /supportive_help
parent73a3a2f19b145ee8d334adac26aac5917b3d20c4 (diff)
downloadsupportive_help-a6f33efee363f6308658325da418571f3156208f.tar.xz
supportive_help-a6f33efee363f6308658325da418571f3156208f.zip
Implemented family-doctype
Diffstat (limited to 'supportive_help')
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/__init__.py0
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.js8
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.json71
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.py46
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/test_sh_family.py9
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_member/__init__.py0
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.json56
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.py9
-rw-r--r--supportive_help/supportive_help/doctype/sh_person/sh_person.json34
-rw-r--r--supportive_help/supportive_help/workspace/supportive_help/supportive_help.json12
-rw-r--r--supportive_help/translations/de.csv23
-rw-r--r--supportive_help/translations/en.csv4
12 files changed, 243 insertions, 29 deletions
diff --git a/supportive_help/supportive_help/doctype/sh_family/__init__.py b/supportive_help/supportive_help/doctype/sh_family/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family/__init__.py
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.js b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
new file mode 100644
index 0000000..06e05bb
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2026, Leon Zimmermann and contributors
+// For license information, please see license.txt
+
+// frappe.ui.form.on("sh_family", {
+// refresh(frm) {
+
+// },
+// });
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.json b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
new file mode 100644
index 0000000..49709bb
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
@@ -0,0 +1,71 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2026-03-17 22:25:22.157656",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "affected_person",
+ "family_member_tab",
+ "family_member",
+ "family_member_count"
+ ],
+ "fields": [
+ {
+ "fieldname": "affected_person",
+ "fieldtype": "Link",
+ "label": "Affected Person",
+ "options": "sh_person",
+ "reqd": 1,
+ "set_only_once": 1
+ },
+ {
+ "fieldname": "family_member_tab",
+ "fieldtype": "Tab Break",
+ "label": "Family Member"
+ },
+ {
+ "fieldname": "family_member",
+ "fieldtype": "Table",
+ "label": "Family Member",
+ "options": "sh_family_member"
+ },
+ {
+ "default": "0",
+ "fieldname": "family_member_count",
+ "fieldtype": "Int",
+ "hidden": 1,
+ "in_list_view": 1,
+ "label": "Family Member Count",
+ "non_negative": 1
+ }
+ ],
+ "grid_page_length": 50,
+ "index_web_pages_for_search": 1,
+ "links": [],
+ "modified": "2026-03-17 23:41:12.819103",
+ "modified_by": "Administrator",
+ "module": "Supportive Help",
+ "name": "sh_family",
+ "naming_rule": "By script",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "row_format": "Dynamic",
+ "rows_threshold_for_grid_search": 20,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+} \ No newline at end of file
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.py b/supportive_help/supportive_help/doctype/sh_family/sh_family.py
new file mode 100644
index 0000000..c809628
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2026, Leon Zimmermann and contributors
+# For license information, please see license.txt
+
+from datetime import datetime
+
+import frappe
+from frappe.model.document import Document
+
+
+class sh_family(Document):
+ def autoname(self):
+ # Abrufen des Vornamens und Nachnamens der verknüpften Person
+ first_name = frappe.db.get_value("sh_person", self.affected_person, "first_name")
+ last_name = frappe.db.get_value("sh_person", self.affected_person, "last_name")
+
+ # Abrufen des Geburtsdatums der verknüpften Person
+ date_of_birth = frappe.db.get_value("sh_person", self.affected_person, "date_of_birth")
+
+ # Formatieren des Geburtsdatums als MM-YYYY
+ dob_formatted = ""
+ if date_of_birth:
+ try:
+ dob = datetime.strptime(str(date_of_birth), "%Y-%m-%d")
+ dob_formatted = dob.strftime("%m-%Y")
+ except (ValueError, TypeError):
+ frappe.log_error(f"Fehler beim Formatieren des Geburtsdatums für {self.affected_person}")
+ dob_formatted = "Unbekannt"
+
+ # Generiere den neuen Namen
+ new_name = f"{last_name}, {first_name} ({dob_formatted})"
+
+ # Prüfe auf Eindeutigkeit des neuen Namens (außer für das aktuelle Dokument)
+ if self.name != new_name:
+ existing_doc = frappe.db.exists("sh_family", {"name": new_name, "name": ("!=", self.name)})
+ if existing_doc:
+ frappe.throw(f"Der Name '{new_name}' existiert bereits.")
+
+ # Aktualisiere den Namen
+ self.name = new_name
+
+ def validate(self):
+ # Aktualisiere das versteckte Feld mit der Anzahl der Zeilen in der Child-Tabelle
+ if hasattr(self, "family_member"):
+ self.family_member_count = len(self.family_member)
+ else:
+ self.family_member_count = 0
diff --git a/supportive_help/supportive_help/doctype/sh_family/test_sh_family.py b/supportive_help/supportive_help/doctype/sh_family/test_sh_family.py
new file mode 100644
index 0000000..e7e0db8
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family/test_sh_family.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2026, Leon Zimmermann and Contributors
+# See license.txt
+
+# import frappe
+from frappe.tests.utils import FrappeTestCase
+
+
+class Testsh_family(FrappeTestCase):
+ pass
diff --git a/supportive_help/supportive_help/doctype/sh_family_member/__init__.py b/supportive_help/supportive_help/doctype/sh_family_member/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_member/__init__.py
diff --git a/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.json b/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.json
new file mode 100644
index 0000000..bf73099
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.json
@@ -0,0 +1,56 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2026-03-17 22:51:20.882354",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "person",
+ "family_position",
+ "group"
+ ],
+ "fields": [
+ {
+ "fieldname": "person",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Person",
+ "options": "sh_person",
+ "reqd": 1
+ },
+ {
+ "default": "Mother",
+ "fieldname": "family_position",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Family Position",
+ "options": "Mother\nFather\nChild\nSister\nBrother\nFoster Mother\nFoster Father\nStepmother\nStepfather\nGrandmother\nGrandfather\nPartner of Mother\nPartner of Father\nOther",
+ "reqd": 1
+ },
+ {
+ "default": "A",
+ "fieldname": "group",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Group",
+ "length": 1,
+ "reqd": 1
+ }
+ ],
+ "grid_page_length": 50,
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2026-03-17 23:20:27.597921",
+ "modified_by": "Administrator",
+ "module": "Supportive Help",
+ "name": "sh_family_member",
+ "owner": "Administrator",
+ "permissions": [],
+ "row_format": "Dynamic",
+ "rows_threshold_for_grid_search": 20,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+} \ No newline at end of file
diff --git a/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.py b/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.py
new file mode 100644
index 0000000..81d532a
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_member/sh_family_member.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2026, Leon Zimmermann and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class sh_family_member(Document):
+ pass
diff --git a/supportive_help/supportive_help/doctype/sh_person/sh_person.json b/supportive_help/supportive_help/doctype/sh_person/sh_person.json
index 9552470..9744234 100644
--- a/supportive_help/supportive_help/doctype/sh_person/sh_person.json
+++ b/supportive_help/supportive_help/doctype/sh_person/sh_person.json
@@ -40,10 +40,12 @@
{
"fieldname": "first_name",
"fieldtype": "Data",
+ "in_list_view": 1,
"label": "First Name",
"length": 64,
"options": "Name",
- "reqd": 1
+ "reqd": 1,
+ "set_only_once": 1
},
{
"fieldname": "column_break_ebpi",
@@ -52,17 +54,20 @@
{
"fieldname": "last_name",
"fieldtype": "Data",
+ "in_list_view": 1,
"label": "Last Name",
"length": 64,
"options": "Name",
- "reqd": 1
+ "reqd": 1,
+ "set_only_once": 1
},
{
"fieldname": "date_of_birth",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date of Birth",
- "reqd": 1
+ "reqd": 1,
+ "set_only_once": 1
},
{
"fieldname": "residence_tab",
@@ -209,7 +214,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2026-03-17 22:16:47.133332",
+ "modified": "2026-03-17 23:41:36.279834",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "sh_person",
@@ -227,27 +232,6 @@
"role": "System Manager",
"share": 1,
"write": 1
- },
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Supportive Help Manager",
- "share": 1,
- "write": 1
- },
- {
- "email": 1,
- "export": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Supportive Help User",
- "share": 1
}
],
"row_format": "Dynamic",
diff --git a/supportive_help/supportive_help/workspace/supportive_help/supportive_help.json b/supportive_help/supportive_help/workspace/supportive_help/supportive_help.json
index 46769e4..c695144 100644
--- a/supportive_help/supportive_help/workspace/supportive_help/supportive_help.json
+++ b/supportive_help/supportive_help/workspace/supportive_help/supportive_help.json
@@ -1,6 +1,6 @@
{
"charts": [],
- "content": "[{\"id\":\"5k1vjcvtDa\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Supportive Help</span>\",\"col\":12}},{\"id\":\"ZNKb-vbrCD\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Person\",\"col\":3}}]",
+ "content": "[{\"id\":\"5k1vjcvtDa\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Supportive Help</span>\",\"col\":12}},{\"id\":\"ZNKb-vbrCD\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Person\",\"col\":3}},{\"id\":\"mktypDfY0i\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Family\",\"col\":3}}]",
"creation": "2026-03-17 19:53:22.895091",
"custom_blocks": [],
"docstatus": 0,
@@ -13,7 +13,7 @@
"is_hidden": 0,
"label": "Supportive Help",
"links": [],
- "modified": "2026-03-17 22:18:56.905409",
+ "modified": "2026-03-17 23:28:25.632423",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "Supportive Help",
@@ -39,6 +39,14 @@
"link_to": "sh_person",
"stats_filter": "[]",
"type": "DocType"
+ },
+ {
+ "color": "Grey",
+ "doc_view": "List",
+ "label": "Family",
+ "link_to": "sh_family",
+ "stats_filter": "[]",
+ "type": "DocType"
}
],
"title": "Supportive Help"
diff --git a/supportive_help/translations/de.csv b/supportive_help/translations/de.csv
index 94e2f0c..3e16a35 100644
--- a/supportive_help/translations/de.csv
+++ b/supportive_help/translations/de.csv
@@ -44,4 +44,25 @@
"Personal Information","Persöhnlich"
"Preschool Reduction Membership Number","Kindergartenermäßigung Mitgliedsnummer"
"Social Institution Membership Number","Sozialzentrum Mitgliedsnummer"
-"social institution","Sozialzentrum" \ No newline at end of file
+"social institution","Sozialzentrum"
+"Affected Person","Betroffende Person"
+"Brother","Bruder"
+"Child","Kind"
+"Family Member","Familienmitglieder"
+"Family Member Count","Familienmitglieder"
+"Family Position","Familienposition"
+"Father","Vater"
+"Foster Father","Pflegevater"
+"Foster Mother","Pflegemutter"
+"Grandfather","Großvater"
+"Grandmother","Großmutter"
+"Mother","Mutter"
+"Partner of Father","Partner des Vaters"
+"Partner of Mother","Partner der Mutter"
+"Person","Person"
+"Sister","Schwester"
+"Stepfather","Stiefvater"
+"Stepmother","Stiefmutter"
+"sh_family","Familie"
+"sh_family_member","Familienmitglied"
+"Family","Familie" \ No newline at end of file
diff --git a/supportive_help/translations/en.csv b/supportive_help/translations/en.csv
index d7b6b9c..df611b0 100644
--- a/supportive_help/translations/en.csv
+++ b/supportive_help/translations/en.csv
@@ -1,4 +1,6 @@
"source_string","translated_string"
"sh_person","Person"
"sh_residence","Residence"
-"sh_person_counterpart","Counterpart" \ No newline at end of file
+"sh_person_counterpart","Counterpart"
+"sh_family","Family"
+"sh_family_member","Family Member" \ No newline at end of file