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