mirror of
https://github.com/meichthys/church.git
synced 2026-02-07 09:23:43 +00:00
Implement event schedules
This commit is contained in:
parent
b25601eeec
commit
f7f8ebdea1
@ -18,6 +18,8 @@
|
||||
"attendance_total",
|
||||
"address",
|
||||
"description",
|
||||
"section_break_bkwy",
|
||||
"schedule",
|
||||
"section_break_dlpa",
|
||||
"attendance"
|
||||
],
|
||||
@ -111,12 +113,22 @@
|
||||
"fieldtype": "Int",
|
||||
"label": "Attendance Total",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_bkwy",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "schedule",
|
||||
"fieldtype": "Table",
|
||||
"label": "Schedule",
|
||||
"options": "Church Event Schedule"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-10-07 23:45:56.379848",
|
||||
"modified": "2025-10-08 01:01:03.335833",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Church Ministries",
|
||||
"name": "Church Event",
|
||||
|
||||
@ -16,22 +16,24 @@ def apply_template(source_name):
|
||||
template = frappe.get_doc("Church Event", source_name)
|
||||
template_dict = template.as_dict()
|
||||
|
||||
copied_doc = {}
|
||||
|
||||
# Specify which fields to include (whitelist approach)
|
||||
include_fields = ["address", "all_day", "description"]
|
||||
|
||||
copied_doc = {"attendance": {}}
|
||||
|
||||
# Copy normal fields
|
||||
for field in include_fields:
|
||||
if field in template_dict:
|
||||
copied_doc[field] = template_dict[field]
|
||||
|
||||
# Copy attendance child table
|
||||
if template_dict.get("attendance"):
|
||||
copied_doc["attendance"] = []
|
||||
for child_row in template_dict["attendance"]:
|
||||
new_row = {} # Create NEW dict for each row
|
||||
for child_field in child_row:
|
||||
new_row[child_field] = child_row[child_field]
|
||||
copied_doc["attendance"].append(new_row) # Append after building complete row
|
||||
|
||||
# Copy child tables
|
||||
include_child_tables = ["attendance", "schedule"]
|
||||
for child_table in include_child_tables:
|
||||
if template_dict.get(child_table):
|
||||
copied_doc[child_table] = []
|
||||
for child_row in template_dict[child_table]:
|
||||
new_row = {}
|
||||
for child_field in child_row:
|
||||
new_row[child_field] = child_row[child_field]
|
||||
copied_doc[child_table].append(new_row)
|
||||
return copied_doc
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-10-08 00:56:01.628491",
|
||||
"description": "Items that make up an event schedule",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"item_type",
|
||||
"item",
|
||||
"start",
|
||||
"end",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "start",
|
||||
"fieldtype": "Datetime",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Start"
|
||||
},
|
||||
{
|
||||
"fieldname": "end",
|
||||
"fieldtype": "Datetime",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "End"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"label": "Description",
|
||||
"width": "2"
|
||||
},
|
||||
{
|
||||
"fieldname": "item_type",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Item Type",
|
||||
"link_filters": "[[\"DocType\",\"name\",\"like\",\"Church%\"]]",
|
||||
"options": "DocType"
|
||||
},
|
||||
{
|
||||
"fieldname": "item",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_preview": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Item",
|
||||
"options": "item_type"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-10-08 01:07:48.837205",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Church Ministries",
|
||||
"name": "Church Event Schedule",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2025, meichthys and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class ChurchEventSchedule(Document):
|
||||
pass
|
||||
Loading…
x
Reference in New Issue
Block a user