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