mirror of
https://github.com/erpnext/foundation.git
synced 2026-10-16 18:00:47 +02:00
feat: added mail function and new fields
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"participant_details_section",
|
"participant_details_section",
|
||||||
"participant_name",
|
"participant_name",
|
||||||
|
"participant_designation",
|
||||||
"column_break_3",
|
"column_break_3",
|
||||||
"email",
|
"email",
|
||||||
"conference_details_section",
|
"conference_details_section",
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
"fieldname": "email",
|
"fieldname": "email",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Email",
|
"label": "Email",
|
||||||
"options": "User"
|
"options": "Email"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "conference_details_section",
|
"fieldname": "conference_details_section",
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
"fieldname": "conference",
|
"fieldname": "conference",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Conference",
|
"label": "Conference",
|
||||||
"options": "\n2017\n2018"
|
"options": "\n2017\n2018\n2019"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "full_conference_tickets",
|
"fieldname": "full_conference_tickets",
|
||||||
@@ -107,9 +108,15 @@
|
|||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "T-Shirt Sizes",
|
"label": "T-Shirt Sizes",
|
||||||
"options": "TShirt Sizes"
|
"options": "TShirt Sizes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "participant_designation",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Participant Designation",
|
||||||
|
"options": "\nCxO\nAnalyst\nConsultant\nDeveloper\nSystem Administrator\nOther"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2019-08-02 10:29:22.188416",
|
"modified": "2019-08-02 19:07:44.339770",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "ERPNext Foundation",
|
"module": "ERPNext Foundation",
|
||||||
"name": "Conference Participant",
|
"name": "Conference Participant",
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ from frappe.model.document import Document
|
|||||||
|
|
||||||
class ConferenceParticipant(Document):
|
class ConferenceParticipant(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.conference = '2018'
|
self.conference = '2019'
|
||||||
if self.owner not in ["Guest", "Administrator"] and not self.get("email"):
|
self.send_ticket_mail()
|
||||||
self.email = frappe.db.get_value('User', self.owner, "email")
|
|
||||||
|
|
||||||
def validate_payment(self):
|
def validate_payment(self):
|
||||||
self.amount = self.full_conference_tickets * (4000 if self.currency == 'INR' else 60)
|
self.amount = self.full_conference_tickets * (4000 if self.currency == 'INR' else 60)
|
||||||
@@ -18,3 +17,19 @@ class ConferenceParticipant(Document):
|
|||||||
def on_payment_authorized(self, status_changed_to=None):
|
def on_payment_authorized(self, status_changed_to=None):
|
||||||
self.paid = 1
|
self.paid = 1
|
||||||
self.save(ignore_permissions=True)
|
self.save(ignore_permissions=True)
|
||||||
|
|
||||||
|
def send_ticket_mail(self):
|
||||||
|
if self.paid == 1:
|
||||||
|
message = """Thank you for participating in the ERPNext Conference {0}.
|
||||||
|
<br> You can find your ticket attached with this email,
|
||||||
|
for more details about the conference please visit https://erpnext.com/conf/{0}""".format(self.conference)
|
||||||
|
email_args = {
|
||||||
|
"recipients": [self.email],
|
||||||
|
"message": _(message),
|
||||||
|
"subject": 'Your Ticket for ERPNext Conference 2019',
|
||||||
|
"attachments": [frappe.attach_print(self.doctype, self.name, file_name=self.name, print_format='Conference Ticket')],
|
||||||
|
"reference_doctype": self.doctype,
|
||||||
|
"reference_name": self.name
|
||||||
|
}
|
||||||
|
frappe.sendmail(**email_args)
|
||||||
|
self.thank_you_email_sent = 1
|
||||||
Reference in New Issue
Block a user