Compare commits

...

4 Commits

Author SHA1 Message Date
Landry
2bb22f5e72 Service Appointment Doctype Created 2024-06-03 22:29:46 +00:00
Landry
77cb64ce34 removed custom modules and doctypes 2024-05-30 11:59:50 +00:00
Landry
6fda96983b Test swtich to master 2024-05-22 22:45:58 +00:00
Landry
867070c6a7 Module and doctype creation 2024-05-22 14:18:12 +00:00
15 changed files with 225 additions and 0 deletions

View File

@ -0,0 +1,8 @@
// Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Service Appointment", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,72 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-06-03 01:56:46.671951",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"section_break_toee",
"contact",
"appointment_date",
"appointment_time",
"service_details",
"status"
],
"fields": [
{
"fieldname": "section_break_toee",
"fieldtype": "Section Break"
},
{
"fieldname": "appointment_date",
"fieldtype": "Date",
"label": "Appointment Date"
},
{
"fieldname": "appointment_time",
"fieldtype": "Time",
"label": "Appointment Time"
},
{
"fieldname": "service_details",
"fieldtype": "Long Text",
"label": "Service Details"
},
{
"fieldname": "status",
"fieldtype": "Select",
"label": "Status",
"options": "Scheduled\nConfirmed\nDeclined"
},
{
"fieldname": "contact",
"fieldtype": "Link",
"label": "Contact",
"options": "Contact"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-06-03 02:13:09.746413",
"modified_by": "Administrator",
"module": "CRM",
"name": "Service Appointment",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,58 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.utils import add_days, nowdate
from frappe.model.document import Document
class ServiceAppointment(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
appointment_date: DF.Date | None
appointment_time: DF.Time | None
contact: DF.Link | None
service_details: DF.LongText | None
status: DF.Literal["Scheduled", "Confirmed", "Declined"]
# end: auto-generated types
pass
@frappe.whitelist()
def create_service_appointments(appointment_date, appointment_time, service_details):
# Get all contacts
contacts = frappe.get_all('Contact')
# Loop through contacts
for contact in contacts:
# Fetch contact document
contact_doc = frappe.get_doc('Contact', contact.name)
# Generate a human-readable name
appointment_name = f"{contact_doc.first_name} {contact_doc.last_name} - {appointment_date} {appointment_time}"
# Determine appointment date and time
appointment_date = add_days(nowdate(), 30) # Example: appointment set 30 days from now
appointment_time = '10:00:00' # Example time
# Create a new Service Appointment document
new_appointment = frappe.get_doc({
'doctype': 'Service Appointment',
'contact': contact_doc.name,
'appointment_date': appointment_date,
'appointment_time': appointment_time,
'service_details': service_details,
'status': 'Scheduled'
})
# Insert the new document into the database
new_appointment.insert()
# Commit the transaction
frappe.db.commit()

View File

@ -0,0 +1,9 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestServiceAppointment(FrappeTestCase):
pass

View File

View File

@ -18,3 +18,4 @@ Communication
Telephony
Bulk Transaction
Subcontracting
Programming Module

View File

View File

@ -0,0 +1,8 @@
// Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Programming Doctype", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,41 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-05-22 12:40:16.572357",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"custom_first_name"
],
"fields": [
{
"fieldname": "custom_first_name",
"fieldtype": "Data",
"label": "First Name"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-05-22 12:40:42.398692",
"modified_by": "Administrator",
"module": "Programming Module",
"name": "Programming Doctype",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,19 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class ProgrammingDoctype(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
custom_first_name: DF.Data | None
# end: auto-generated types
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestProgrammingDoctype(FrappeTestCase):
pass