blob: 5b0ce391a131108644d9b2cc8759c9243beac00e [file] [log] [blame]
Anand Doshi885e0742015-03-03 14:55:30 +05301# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
Rushabh Mehta30430792013-12-13 15:33:40 +05302# License: GNU General Public License v3. See license.txt
3
4from __future__ import unicode_literals
Rohit Waghchaure07ef5f42017-04-26 18:25:54 +05305import frappe
Rushabh Mehta30430792013-12-13 15:33:40 +05306
7def get_notification_config():
Prateeksha Singhe012e242017-07-18 10:35:12 +05308 notifications = { "for_doctype":
Rushabh Mehta30430792013-12-13 15:33:40 +05309 {
Rushabh Mehta905f8322015-03-02 13:01:39 +053010 "Issue": {"status": "Open"},
11 "Warranty Claim": {"status": "Open"},
Rushabh Mehta868bb262017-03-09 18:11:11 +053012 "Task": {"status": ("in", ("Open", "Overdue"))},
Rushabh Mehta856ee102015-07-17 15:03:18 +053013 "Project": {"status": "Open"},
Rushabh Mehta15a7f212016-04-14 17:30:40 +053014 "Item": {"total_projected_qty": ("<", 0)},
Rushabh Mehta905f8322015-03-02 13:01:39 +053015 "Lead": {"status": "Open"},
16 "Contact": {"status": "Open"},
Rushabh Mehtaf579cf92015-04-13 16:58:47 +053017 "Opportunity": {"status": "Open"},
18 "Quotation": {"docstatus": 0},
Rushabh Mehtad10ba852015-10-02 12:42:48 +053019 "Sales Order": {
patilsangrambf2b5112016-02-22 16:24:23 +053020 "status": ("not in", ("Completed", "Closed")),
Rushabh Mehtad10ba852015-10-02 12:42:48 +053021 "docstatus": ("<", 2)
22 },
Rushabh Mehta905f8322015-03-02 13:01:39 +053023 "Journal Entry": {"docstatus": 0},
Nabin Hait906552a2016-09-05 14:35:23 +053024 "Sales Invoice": {
Rushabh Mehta87037bd2017-01-30 12:29:54 +053025 "outstanding_amount": (">", 0),
26 "docstatus": ("<", 2)
Nabin Hait906552a2016-09-05 14:35:23 +053027 },
28 "Purchase Invoice": {
Rushabh Mehta87037bd2017-01-30 12:29:54 +053029 "outstanding_amount": (">", 0),
Nabin Hait906552a2016-09-05 14:35:23 +053030 "docstatus": ("<", 2)
31 },
Manas Solanki546ca312016-11-05 01:14:29 +053032 "Payment Entry": {"docstatus": 0},
Rushabh Mehta905f8322015-03-02 13:01:39 +053033 "Leave Application": {"status": "Open"},
34 "Expense Claim": {"approval_status": "Draft"},
35 "Job Applicant": {"status": "Open"},
Nabin Hait906552a2016-09-05 14:35:23 +053036 "Delivery Note": {
37 "status": ("not in", ("Completed", "Closed")),
38 "docstatus": ("<", 2)
39 },
Rushabh Mehta905f8322015-03-02 13:01:39 +053040 "Stock Entry": {"docstatus": 0},
Rushabh Mehta44038532016-02-27 16:24:34 +053041 "Material Request": {
Anand Doshi44f777e2016-03-07 19:35:34 +053042 "docstatus": ("<", 2),
Rushabh Mehta44038532016-02-27 16:24:34 +053043 "status": ("not in", ("Stopped",)),
44 "per_ordered": ("<", 100)
45 },
Rushabh Mehta5d0e8de2016-04-11 17:34:25 +053046 "Request for Quotation": { "docstatus": 0 },
47 "Supplier Quotation": {"docstatus": 0},
Rushabh Mehtad10ba852015-10-02 12:42:48 +053048 "Purchase Order": {
patilsangrambf2b5112016-02-22 16:24:23 +053049 "status": ("not in", ("Completed", "Closed")),
Rushabh Mehtad10ba852015-10-02 12:42:48 +053050 "docstatus": ("<", 2)
51 },
Nabin Hait906552a2016-09-05 14:35:23 +053052 "Purchase Receipt": {
53 "status": ("not in", ("Completed", "Closed")),
54 "docstatus": ("<", 2)
55 },
Rushabh Mehta15a7f212016-04-14 17:30:40 +053056 "Production Order": { "status": ("in", ("Draft", "Not Started", "In Process")) },
Rushabh Mehta905f8322015-03-02 13:01:39 +053057 "BOM": {"docstatus": 0},
Rohit Waghchauree94d18b2016-07-06 20:12:58 +053058 "Timesheet": {"status": "Draft"}
Prateeksha Singhe012e242017-07-18 10:35:12 +053059 },
60
61 "targets": {
62 "Company": {
63 "filters" : { "sales_target": ( ">", 0 ) },
64 "target_field" : "sales_target",
65 "value_field" : "total_monthly_sales"
66 }
Rushabh Mehta30430792013-12-13 15:33:40 +053067 }
Rushabh Mehtae9138832015-02-25 12:04:49 +053068 }
Rohit Waghchaure07ef5f42017-04-26 18:25:54 +053069
Prateeksha Singhe012e242017-07-18 10:35:12 +053070 doctype = [d for d in notifications.get('for_doctype')]
Rohit Waghchaure07ef5f42017-04-26 18:25:54 +053071 for doc in frappe.get_all('DocType',
72 fields= ["name"], filters = {"name": ("not in", doctype), 'is_submittable': 1}):
Prateeksha Singhe012e242017-07-18 10:35:12 +053073 notifications["for_doctype"][doc.name] = {"docstatus": 0}
Rohit Waghchaure07ef5f42017-04-26 18:25:54 +053074
Prateeksha Singhe012e242017-07-18 10:35:12 +053075 return notifications