bed meeting notes page
This commit is contained in:
parent
ba3e2a4d8e
commit
28c57c4ad0
6 changed files with 17236 additions and 20 deletions
|
|
@ -20,7 +20,10 @@ def after_install():
|
|||
update_onsite_meeting_fields()
|
||||
update_address_fields()
|
||||
check_and_create_holiday_list()
|
||||
create_snw_install_task_types()
|
||||
create_project_templates()
|
||||
create_task_types()
|
||||
create_tasks()
|
||||
create_bid_meeting_note_form_templates()
|
||||
build_frontend()
|
||||
|
||||
def after_migrate():
|
||||
|
|
@ -35,7 +38,10 @@ def after_migrate():
|
|||
frappe.reload_doctype(doctype)
|
||||
|
||||
check_and_create_holiday_list()
|
||||
create_snw_install_task_types()
|
||||
# create_project_templates()
|
||||
create_task_types()
|
||||
# create_tasks
|
||||
# create_bid_meeting_note_form_templates()
|
||||
|
||||
# update_address_fields()
|
||||
# build_frontend()
|
||||
|
|
@ -1024,10 +1030,11 @@ def get_all_sundays(year):
|
|||
|
||||
return sundays
|
||||
|
||||
def create_snw_install_task_types():
|
||||
def create_task_types():
|
||||
task_types = [
|
||||
{
|
||||
"title": "Locate",
|
||||
"title": "811/Locate",
|
||||
"name": "811/Locate",
|
||||
"description": "Utility locate request prior to installation start.",
|
||||
"base_date": "Start",
|
||||
"offset_days": 7,
|
||||
|
|
@ -1037,6 +1044,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "Permit",
|
||||
"name": "Permit",
|
||||
"description": "Permits required prior to installation start.",
|
||||
"base_date": "Start",
|
||||
"offset_days": 7,
|
||||
|
|
@ -1046,6 +1054,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "1/2 Down Payment",
|
||||
"name": "1/2 Down Payment",
|
||||
"description": "Collect half down payment on project creation.",
|
||||
"calculate_from": "Project",
|
||||
"trigger": "Created",
|
||||
|
|
@ -1053,6 +1062,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "Machine Staging",
|
||||
"name": "Machine Staging",
|
||||
"description": "Stage machinery one day before installation start.",
|
||||
"base_date": "Start",
|
||||
"offset_days": 1,
|
||||
|
|
@ -1062,6 +1072,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "Final Invoice",
|
||||
"name": "Final Invoice",
|
||||
"description": "Send final invoice within 5 days of job completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 5,
|
||||
|
|
@ -1071,6 +1082,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "Backflow Test",
|
||||
"name": "Backflow Test",
|
||||
"description": "Backflow test after job completion if quoted.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 0,
|
||||
|
|
@ -1080,6 +1092,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "Schedule Permit Inspection",
|
||||
"name": "Schedule Permit Inspection",
|
||||
"description": "Schedule permit inspection 5 days after completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 5,
|
||||
|
|
@ -1089,6 +1102,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "15 Day Warranty Follow-Up",
|
||||
"name": "15 Day Warranty Follow-Up",
|
||||
"description": "15-day warranty follow-up after completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 15,
|
||||
|
|
@ -1098,6 +1112,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "30 Day Warranty Check",
|
||||
"name": "30 Day Warranty Check",
|
||||
"description": "30-day warranty check after completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 30,
|
||||
|
|
@ -1107,6 +1122,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "30 Day Payment Reminder",
|
||||
"name": "30 Day Payment Reminder",
|
||||
"description": "Payment reminder sent 30 days after completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 30,
|
||||
|
|
@ -1116,6 +1132,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "60 Day Late Payment Notice",
|
||||
"name": "60 Day Late Payment Notice",
|
||||
"description": "Late payment notification at 60 days post completion.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 60,
|
||||
|
|
@ -1125,6 +1142,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "80 Day Lien Notice",
|
||||
"name": "80 Day Lien Notice",
|
||||
"description": "Lien notice if payment is still late after 80 days.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 80,
|
||||
|
|
@ -1134,6 +1152,7 @@ def create_snw_install_task_types():
|
|||
},
|
||||
{
|
||||
"title": "365 Day Warranty Call / Walk",
|
||||
"name": "365 Day Warranty Call / Walk",
|
||||
"description": "One-year warranty call or walk-through.",
|
||||
"base_date": "Completion",
|
||||
"offset_days": 365,
|
||||
|
|
@ -1145,12 +1164,13 @@ def create_snw_install_task_types():
|
|||
|
||||
for task_type in task_types:
|
||||
# Idempotency check
|
||||
if frappe.db.exists("Task Type", task_type["title"]):
|
||||
if frappe.db.exists("Task Type", task_type["name"]):
|
||||
continue
|
||||
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Task Type",
|
||||
"title": task_type["title"],
|
||||
"name": task_type["name"],
|
||||
"description": task_type["description"],
|
||||
"base_date": task_type.get("base_date"),
|
||||
"offset_days": task_type.get("offset_days", 0),
|
||||
|
|
@ -1161,5 +1181,141 @@ def create_snw_install_task_types():
|
|||
})
|
||||
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
|
||||
frappe.db.commit()
|
||||
frappe.db.commit()
|
||||
|
||||
def create_tasks():
|
||||
print("\n🔧 Creating default Tasks if they do not exist...")
|
||||
default_tasks = [
|
||||
{
|
||||
"task_name": "Initial Consultation",
|
||||
"description": "Conduct an initial consultation with the client to discuss project requirements.",
|
||||
"status": "Open",
|
||||
"priority": "High",
|
||||
"type": "Consultation"
|
||||
},
|
||||
{
|
||||
"task_name": "Site Survey",
|
||||
"description": "Perform a site survey to assess conditions and gather necessary data.",
|
||||
"status": "Open",
|
||||
"priority": "Medium"
|
||||
},
|
||||
{
|
||||
"task_name": "Design Proposal",
|
||||
"description": "Prepare and present a design proposal based on client needs and site survey findings.",
|
||||
"status": "Open",
|
||||
"priority": "High"
|
||||
}
|
||||
]
|
||||
|
||||
for task in default_tasks:
|
||||
if frappe.db.exists("Task", task["task_name"]):
|
||||
continue
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Task",
|
||||
"is_template": 1,
|
||||
"task_name": task["task_name"],
|
||||
"description": task["description"],
|
||||
"status": task["status"],
|
||||
"priority": task["priority"],
|
||||
"type": task["type"]
|
||||
})
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
def create_project_templates():
|
||||
"""Create default Project Templates if they do not exist."""
|
||||
print("\n🔧 Checking for default Project Templates...")
|
||||
templates = {
|
||||
"snw_templates": [
|
||||
{
|
||||
"name": "SNW Install",
|
||||
"project_type": "Service",
|
||||
"company": "Sprinklers Northwest",
|
||||
"calendar_color": "#FF5733" # Example color
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
def create_bid_meeting_note_form_templates():
|
||||
"""Create Bid Meeting Note Forms if they do not exist."""
|
||||
print("\n🔧 Checking for Bid Meeting Note Forms...")
|
||||
forms = {
|
||||
"Sprinklers Northwest": [
|
||||
{
|
||||
"name": "SNW Install Bid Meeting Notes",
|
||||
"title": "SNW Install Bid Meeting Notes",
|
||||
"description": "Notes form for SNW Install bid meetings.",
|
||||
"project_template": "SNW Install",
|
||||
"fields": [{
|
||||
"label": "Locate Needed",
|
||||
"type": "Check",
|
||||
"required": 1,
|
||||
"help_text": "Indicate if a locate is needed for this project.",
|
||||
"row": 1,
|
||||
"column": 1
|
||||
},
|
||||
{
|
||||
"label": "Permit Needed",
|
||||
"type": "Check",
|
||||
"required": 1,
|
||||
"help_text": "Indicate if a permit is needed for this project.",
|
||||
"row": 1,
|
||||
"column": 2
|
||||
},
|
||||
{
|
||||
"label": "Back Flow Test Required",
|
||||
"type": "Check",
|
||||
"required": 1,
|
||||
"help_text": "Indicate if a backflow test is required after installation.",
|
||||
"row": 1,
|
||||
"column": 3
|
||||
},
|
||||
{
|
||||
"label": "Machine Access",
|
||||
"type": "Check",
|
||||
"required": 1,
|
||||
"row": 2,
|
||||
"column": 1
|
||||
},
|
||||
{
|
||||
"label": "Machines",
|
||||
"type": "Multi-Select",
|
||||
"options": "MT, Skip Steer, Excavator-E-50, Link Belt, Tre?, Forks, Auger, Backhoe, Loader, Duzer",
|
||||
"required": 0,
|
||||
"include_options": 1,
|
||||
"conditional_on_field": "Machine Access",
|
||||
"row": 2,
|
||||
"column": 2
|
||||
},
|
||||
{
|
||||
"label": "Materials Required",
|
||||
"type": "Check",
|
||||
"required": 1,
|
||||
"row": 3,
|
||||
"column": 0
|
||||
},
|
||||
{
|
||||
"label": "Materials",
|
||||
"type": "Multi-Select w/ Quantity",
|
||||
"required": 0,
|
||||
"doctype_for_select": "Item",
|
||||
"conditional_on_field": "Materials Required",
|
||||
"doctype_label_field": "itemName",
|
||||
"row": 4,
|
||||
"column": 0
|
||||
}]
|
||||
}]}
|
||||
for company, form_list in forms.items():
|
||||
for form in form_list:
|
||||
if frappe.db.exists("Bid Meeting Note Form", form["name"]):
|
||||
continue
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Bid Meeting Note Form",
|
||||
"company": company,
|
||||
"title": form["title"],
|
||||
"description": form["description"],
|
||||
"project_template": form["project_template"],
|
||||
"fields": form["fields"]
|
||||
})
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue