mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Fixed leads
This commit is contained in:
@@ -16,18 +16,15 @@ class Appointment(Document):
|
|||||||
|
|
||||||
def before_insert(self):
|
def before_insert(self):
|
||||||
appointment_event = frappe.new_doc('Event')
|
appointment_event = frappe.new_doc('Event')
|
||||||
appointment_event.subject = 'Appointment with ' + self.customer_name
|
appointment_event = frappe.get_doc({
|
||||||
appointment_event.starts_on = self.scheduled_time
|
"doctype": "Event",
|
||||||
appointment_event.status = 'Open'
|
"subject": ' '.join(['Appointment with', self.customer_name]),
|
||||||
appointment_event.type = 'Private'
|
"starts_on": self.scheduled_time,
|
||||||
settings = frappe.get_doc('Appointment Booking Settings')
|
"status": "Open",
|
||||||
appointment_event.ends_on = self.scheduled_time + timedelta(minutes=settings.appointment_duration)
|
"type": "Private",
|
||||||
event_participants = []
|
"event_participants": [dict(reference_doctype="Lead", reference_docname=self.lead)]
|
||||||
event_participant_customer = frappe.new_doc('Event Participants')
|
})
|
||||||
event_participant_customer.reference_doctype = 'Lead'
|
|
||||||
event_participant_customer.reference_docname = self.lead
|
appointment_event.insert(ignore_permissions=True)
|
||||||
event_participants.append(event_participant_customer)
|
|
||||||
appointment_event.event_participants = event_participants
|
|
||||||
appointment_event.insert()
|
|
||||||
self.calender_event = appointment_event.name
|
self.calender_event = appointment_event.name
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user