Anand Doshi | 885e074 | 2015-03-03 14:55:30 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
Rushabh Mehta | 3043079 | 2013-12-13 15:33:40 +0530 | [diff] [blame] | 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
Rohit Waghchaure | 07ef5f4 | 2017-04-26 18:25:54 +0530 | [diff] [blame] | 5 | import frappe |
Rushabh Mehta | 3043079 | 2013-12-13 15:33:40 +0530 | [diff] [blame] | 6 | |
| 7 | def get_notification_config(): |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 8 | notifications = { "for_doctype": |
Rushabh Mehta | 3043079 | 2013-12-13 15:33:40 +0530 | [diff] [blame] | 9 | { |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 10 | "Issue": {"status": "Open"}, |
| 11 | "Warranty Claim": {"status": "Open"}, |
Rushabh Mehta | 868bb26 | 2017-03-09 18:11:11 +0530 | [diff] [blame] | 12 | "Task": {"status": ("in", ("Open", "Overdue"))}, |
Rushabh Mehta | 856ee10 | 2015-07-17 15:03:18 +0530 | [diff] [blame] | 13 | "Project": {"status": "Open"}, |
Rushabh Mehta | 15a7f21 | 2016-04-14 17:30:40 +0530 | [diff] [blame] | 14 | "Item": {"total_projected_qty": ("<", 0)}, |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 15 | "Lead": {"status": "Open"}, |
| 16 | "Contact": {"status": "Open"}, |
Rushabh Mehta | f579cf9 | 2015-04-13 16:58:47 +0530 | [diff] [blame] | 17 | "Opportunity": {"status": "Open"}, |
| 18 | "Quotation": {"docstatus": 0}, |
Rushabh Mehta | d10ba85 | 2015-10-02 12:42:48 +0530 | [diff] [blame] | 19 | "Sales Order": { |
patilsangram | bf2b511 | 2016-02-22 16:24:23 +0530 | [diff] [blame] | 20 | "status": ("not in", ("Completed", "Closed")), |
Rushabh Mehta | d10ba85 | 2015-10-02 12:42:48 +0530 | [diff] [blame] | 21 | "docstatus": ("<", 2) |
| 22 | }, |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 23 | "Journal Entry": {"docstatus": 0}, |
Nabin Hait | 906552a | 2016-09-05 14:35:23 +0530 | [diff] [blame] | 24 | "Sales Invoice": { |
Rushabh Mehta | 87037bd | 2017-01-30 12:29:54 +0530 | [diff] [blame] | 25 | "outstanding_amount": (">", 0), |
| 26 | "docstatus": ("<", 2) |
Nabin Hait | 906552a | 2016-09-05 14:35:23 +0530 | [diff] [blame] | 27 | }, |
| 28 | "Purchase Invoice": { |
Rushabh Mehta | 87037bd | 2017-01-30 12:29:54 +0530 | [diff] [blame] | 29 | "outstanding_amount": (">", 0), |
Nabin Hait | 906552a | 2016-09-05 14:35:23 +0530 | [diff] [blame] | 30 | "docstatus": ("<", 2) |
| 31 | }, |
Manas Solanki | 546ca31 | 2016-11-05 01:14:29 +0530 | [diff] [blame] | 32 | "Payment Entry": {"docstatus": 0}, |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 33 | "Leave Application": {"status": "Open"}, |
| 34 | "Expense Claim": {"approval_status": "Draft"}, |
| 35 | "Job Applicant": {"status": "Open"}, |
Nabin Hait | 906552a | 2016-09-05 14:35:23 +0530 | [diff] [blame] | 36 | "Delivery Note": { |
| 37 | "status": ("not in", ("Completed", "Closed")), |
| 38 | "docstatus": ("<", 2) |
| 39 | }, |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 40 | "Stock Entry": {"docstatus": 0}, |
Rushabh Mehta | 4403853 | 2016-02-27 16:24:34 +0530 | [diff] [blame] | 41 | "Material Request": { |
Anand Doshi | 44f777e | 2016-03-07 19:35:34 +0530 | [diff] [blame] | 42 | "docstatus": ("<", 2), |
Rushabh Mehta | 4403853 | 2016-02-27 16:24:34 +0530 | [diff] [blame] | 43 | "status": ("not in", ("Stopped",)), |
| 44 | "per_ordered": ("<", 100) |
| 45 | }, |
Rushabh Mehta | 5d0e8de | 2016-04-11 17:34:25 +0530 | [diff] [blame] | 46 | "Request for Quotation": { "docstatus": 0 }, |
| 47 | "Supplier Quotation": {"docstatus": 0}, |
Rushabh Mehta | d10ba85 | 2015-10-02 12:42:48 +0530 | [diff] [blame] | 48 | "Purchase Order": { |
patilsangram | bf2b511 | 2016-02-22 16:24:23 +0530 | [diff] [blame] | 49 | "status": ("not in", ("Completed", "Closed")), |
Rushabh Mehta | d10ba85 | 2015-10-02 12:42:48 +0530 | [diff] [blame] | 50 | "docstatus": ("<", 2) |
| 51 | }, |
Nabin Hait | 906552a | 2016-09-05 14:35:23 +0530 | [diff] [blame] | 52 | "Purchase Receipt": { |
| 53 | "status": ("not in", ("Completed", "Closed")), |
| 54 | "docstatus": ("<", 2) |
| 55 | }, |
Rushabh Mehta | 15a7f21 | 2016-04-14 17:30:40 +0530 | [diff] [blame] | 56 | "Production Order": { "status": ("in", ("Draft", "Not Started", "In Process")) }, |
Rushabh Mehta | 905f832 | 2015-03-02 13:01:39 +0530 | [diff] [blame] | 57 | "BOM": {"docstatus": 0}, |
Rushabh Mehta | f056974 | 2017-09-13 12:52:30 +0530 | [diff] [blame] | 58 | |
| 59 | "Timesheet": {"status": "Draft"}, |
| 60 | |
| 61 | "Lab Test": {"docstatus": 0}, |
| 62 | "Sample Collection": {"docstatus": 0}, |
| 63 | "Patient Appointment": {"status": "Open"}, |
| 64 | "Consultation": {"docstatus": 0} |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 65 | }, |
| 66 | |
| 67 | "targets": { |
| 68 | "Company": { |
Prateeksha Singh | 95d8fd3 | 2017-09-04 11:14:04 +0530 | [diff] [blame] | 69 | "filters" : { "monthly_sales_target": ( ">", 0 ) }, |
| 70 | "target_field" : "monthly_sales_target", |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 71 | "value_field" : "total_monthly_sales" |
| 72 | } |
Rushabh Mehta | 3043079 | 2013-12-13 15:33:40 +0530 | [diff] [blame] | 73 | } |
Rushabh Mehta | e913883 | 2015-02-25 12:04:49 +0530 | [diff] [blame] | 74 | } |
Rohit Waghchaure | 07ef5f4 | 2017-04-26 18:25:54 +0530 | [diff] [blame] | 75 | |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 76 | doctype = [d for d in notifications.get('for_doctype')] |
Rohit Waghchaure | 07ef5f4 | 2017-04-26 18:25:54 +0530 | [diff] [blame] | 77 | for doc in frappe.get_all('DocType', |
| 78 | fields= ["name"], filters = {"name": ("not in", doctype), 'is_submittable': 1}): |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 79 | notifications["for_doctype"][doc.name] = {"docstatus": 0} |
Rohit Waghchaure | 07ef5f4 | 2017-04-26 18:25:54 +0530 | [diff] [blame] | 80 | |
Prateeksha Singh | e012e24 | 2017-07-18 10:35:12 +0530 | [diff] [blame] | 81 | return notifications |