summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOsCoder <oscoder@lczimmermann.eu>2026-04-08 13:25:33 +0000
committerOsCoder <oscoder@lczimmermann.eu>2026-04-08 13:25:33 +0000
commit47a0d87eeba1554f98f463de8c9bee0fc23a4a71 (patch)
tree81bdd16ff252d5f0f0e4e21725c0ad645e07278c
parentd25312f8a315714b1c097cc119a9ca6f26b7d7f5 (diff)
downloadsupportive_help-47a0d87eeba1554f98f463de8c9bee0fc23a4a71.tar.xz
supportive_help-47a0d87eeba1554f98f463de8c9bee0fc23a4a71.zip
Completed family_notes as their own doctype
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.js19
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.json20
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json53
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py19
-rw-r--r--supportive_help/supportive_help/workspace/supportive_help/supportive_help.json12
5 files changed, 79 insertions, 44 deletions
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.js b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
index a990b5a..62f6c87 100644
--- a/supportive_help/supportive_help/doctype/sh_family/sh_family.js
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
@@ -1,21 +1,2 @@
// Copyright (c) 2026, Leon Zimmermann and contributors
// For license information, please see license.txt
-
-frappe.ui.form.on("sh_family_note", {
- note: function (frm, cdt, cdn) {
- // Aktuelles Child-Dokument holen
- const child_row = frappe.get_doc(cdt, cdn);
-
- // Wortzählung durchfüren
- if (child_row.note) {
- const words = child_row.note
- .trim()
- .split(/\s+/)
- .filter((word) => word.length > 0);
- frappe.model.set_value(cdt, cdn, "word_count", words.length);
- console.log("Wortanzahl aktualisiert:", words.length);
- } else {
- frappe.model.set_value(cdt, cdn, "word_count", 0);
- }
- },
-});
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.json b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
index 5e2b5af..ed8e999 100644
--- a/supportive_help/supportive_help/doctype/sh_family/sh_family.json
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
@@ -10,9 +10,7 @@
"family_member_tab",
"family_member",
"family_member_count",
- "note_tab",
- "section_break_ybmq",
- "notes"
+ "connection_tab"
],
"fields": [
{
@@ -44,25 +42,15 @@
"non_negative": 1
},
{
- "fieldname": "note_tab",
+ "fieldname": "connection_tab",
"fieldtype": "Tab Break",
- "label": "Notes"
- },
- {
- "fieldname": "notes",
- "fieldtype": "Table",
- "label": "Notes",
- "options": "sh_family_note"
- },
- {
- "fieldname": "section_break_ybmq",
- "fieldtype": "Section Break"
+ "label": "Connections"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2026-04-07 00:48:19.304376",
+ "modified": "2026-04-08 13:35:41.027189",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "sh_family",
diff --git a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json
index e6c158d..a1678f7 100644
--- a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json
+++ b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json
@@ -5,21 +5,39 @@
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
- "section_break_xwdq"
+ "family",
+ "note",
+ "word_count"
],
"fields": [
{
- "fieldname": "section_break_xwdq",
- "fieldtype": "Section Break"
+ "fieldname": "note",
+ "fieldtype": "Text Editor",
+ "label": "Note"
+ },
+ {
+ "default": "0",
+ "fieldname": "word_count",
+ "fieldtype": "Int",
+ "label": "Word Count",
+ "non_negative": 1
+ },
+ {
+ "fieldname": "family",
+ "fieldtype": "Link",
+ "label": "Family",
+ "options": "sh_family",
+ "set_only_once": 1
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2026-04-08 12:43:41.447042",
+ "modified": "2026-04-08 13:53:50.992598",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "sh_family_note",
+ "naming_rule": "By script",
"owner": "Administrator",
"permissions": [
{
@@ -33,11 +51,36 @@
"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
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Supportive Help User",
+ "share": 1,
+ "write": 1
}
],
"row_format": "Dynamic",
"rows_threshold_for_grid_search": 20,
"sort_field": "modified",
"sort_order": "DESC",
- "states": []
+ "states": [],
+ "track_views": 1
} \ No newline at end of file
diff --git a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py
index 0e15a4f..4dc1b87 100644
--- a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py
+++ b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py
@@ -1,9 +1,24 @@
# Copyright (c) 2026, Leon Zimmermann and contributors
# For license information, please see license.txt
-# import frappe
+
+import re
+from datetime import datetime
+
+import frappe
from frappe.model.document import Document
class sh_family_note(Document):
- pass
+ def before_save(self):
+ if self.note:
+ # Remove HTML tags using regex
+ text_without_html = re.sub(r"<[^>]+>", " ", self.note)
+ words = text_without_html.split()
+ self.word_count = len(words)
+
+ def autoname(self):
+ today = datetime.now().strftime("%d.%m.%Y")
+ user = frappe.session.user
+ family_name = self.get("family") or "Unbekannt"
+ self.name = f"{family_name} am {today} von {user}"
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 c695144..7cde62b 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}},{\"id\":\"mktypDfY0i\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Family\",\"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}},{\"id\":\"yW49eNzdjh\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Notes\",\"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 23:28:25.632423",
+ "modified": "2026-04-08 13:36:51.035653",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "Supportive Help",
@@ -35,6 +35,14 @@
{
"color": "Grey",
"doc_view": "List",
+ "label": "Notes",
+ "link_to": "sh_family_note",
+ "stats_filter": "[]",
+ "type": "DocType"
+ },
+ {
+ "color": "Grey",
+ "doc_view": "List",
"label": "Person",
"link_to": "sh_person",
"stats_filter": "[]",