From b734ee469b7df30004efa010c19193907f245c5c Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Tue, 2 Oct 2018 12:37:50 +0530 Subject: [PATCH] add field to fetch email for participants --- .../conference_participant.json | 254 ++++++++++++++---- .../conference_participant.py | 5 +- 2 files changed, 211 insertions(+), 48 deletions(-) diff --git a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json index 64b055c4..54f1ffa5 100644 --- a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json +++ b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, - "autoname": "E-CON-2018-.###", + "autoname": "E-CON-.YYYY.-.###", "beta": 0, "creation": "2017-07-06 16:20:28.662095", "custom": 0, @@ -20,6 +20,38 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fieldname": "participant_details_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Participant Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "fieldname": "participant_name", "fieldtype": "Data", "hidden": 0, @@ -52,6 +84,103 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "email", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Email", + "length": 0, + "no_copy": 0, + "options": "User", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "conference_details_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Conference Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "default": "", "fieldname": "conference", "fieldtype": "Select", @@ -150,8 +279,40 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "tshirt_size", - "fieldtype": "Select", + "fieldname": "paid", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Paid", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_10", + "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -159,10 +320,8 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "T-Shirt Size", "length": 0, "no_copy": 0, - "options": "S\nM\nL\nXL\nXXL\nXXXL", "permlevel": 0, "precision": "", "print_hide": 0, @@ -183,19 +342,52 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "currency", + "fieldname": "tshirt_size", "fieldtype": "Select", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, - "label": "Currency", + "label": "T-Shirt Size", "length": 0, "no_copy": 0, - "options": "USD\nINR", + "options": "S\nM\nL\nXL\nXXL\nXXXL", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "USD\nINR", "permlevel": 0, "precision": "", "print_hide": 0, @@ -216,16 +408,16 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "amount", - "fieldtype": "Currency", + "fieldname": "amount", + "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 1, "in_standard_filter": 0, - "label": "Amount", + "label": "Amount", "length": 0, "no_copy": 0, "permlevel": 0, @@ -235,39 +427,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "paid", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Paid", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "translatable": 0, @@ -316,7 +476,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-07-12 16:12:42.283557", + "modified": "2018-10-02 12:44:37.868959", "modified_by": "Administrator", "module": "ERPNext Foundation", "name": "Conference Participant", diff --git a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py index e664d0b6..86e61823 100644 --- a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py +++ b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py @@ -9,9 +9,12 @@ from frappe.model.document import Document class ConferenceParticipant(Document): def validate(self): self.conference = '2018' + if self.owner not in ["Guest", "Administrator"] and not self.get("email") \ + and frappe.db.get_value("User", self.owner, "user_type") == "Website User": + self.email = frappe.db.get_value('User', self.owner, "email") 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) def on_payment_authorized(self, status_changed_to=None): self.paid = 1