Charles-Henri Decultot | efd776d | 2018-10-03 07:11:26 +0200 | [diff] [blame] | 1 | // Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | // MIT License. See license.txt |
| 3 | frappe.provide("frappe.desk"); |
| 4 | |
| 5 | frappe.ui.form.on("Event", { |
| 6 | refresh: function(frm) { |
| 7 | frm.set_query('reference_doctype', "event_participants", function() { |
| 8 | return { |
| 9 | "filters": { |
| 10 | "name": ["in", ["Contact", "Lead", "Customer", "Supplier", "Employee", "Sales Partner"]] |
| 11 | } |
| 12 | }; |
| 13 | }); |
| 14 | |
| 15 | frm.add_custom_button(__('Add Leads'), function() { |
| 16 | new frappe.desk.eventParticipants(frm, "Lead"); |
| 17 | }, __("Add Participants")); |
| 18 | |
| 19 | frm.add_custom_button(__('Add Customers'), function() { |
| 20 | new frappe.desk.eventParticipants(frm, "Customer"); |
| 21 | }, __("Add Participants")); |
| 22 | |
| 23 | frm.add_custom_button(__('Add Suppliers'), function() { |
| 24 | new frappe.desk.eventParticipants(frm, "Supplier"); |
| 25 | }, __("Add Participants")); |
| 26 | |
| 27 | frm.add_custom_button(__('Add Employees'), function() { |
| 28 | new frappe.desk.eventParticipants(frm, "Employee"); |
| 29 | }, __("Add Participants")); |
| 30 | |
| 31 | frm.add_custom_button(__('Add Sales Partners'), function() { |
| 32 | new frappe.desk.eventParticipants(frm, "Sales Partners"); |
| 33 | }, __("Add Participants")); |
| 34 | } |
| 35 | }); |