diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 2fcca755d8..a01dc29be7 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -113,18 +113,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte $.each(doc["items"], function(i, row) { if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note) }) - - if(this.frm.doc.is_pos) { - this.frm.msgbox = frappe.msgprint( - ` - ${__('Print')} - - ${__('New')}` - ); - - } else if(cint(frappe.boot.notification_settings.sales_invoice)) { - this.frm.email_doc(frappe.boot.notification_settings.sales_invoice_message); - } }, set_default_print_format: function() { diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index c97db6db10..671408f5a1 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -409,12 +409,6 @@ cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt } } -cur_frm.cscript.on_submit = function(doc, cdt, cdn) { - if(cint(frappe.boot.notification_settings.purchase_order)) { - cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message); - } -} - function set_schedule_date(frm) { if(frm.doc.schedule_date){ erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date"); diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py index 878b2f2a0c..e38b30d5e0 100644 --- a/erpnext/config/setup.py +++ b/erpnext/config/setup.py @@ -81,12 +81,6 @@ def get_data(): "type": "doctype", "name": "Authorization Rule", "description": _("Create rules to restrict transactions based on values.") - }, - { - "type": "doctype", - "name": "Notification Control", - "label": _("Email Notifications"), - "description": _("Automatically compose message on submission of transactions.") } ] }, diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 5e0648827b..b6dcd52663 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -120,12 +120,6 @@ cur_frm.cscript.calculate_total_amount = function(doc,cdt,cdn){ cur_frm.cscript.calculate_total(doc,cdt,cdn); }; -cur_frm.cscript.on_submit = function() { - if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) { - cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message); - } -}; - erpnext.expense_claim = { set_title :function(frm) { if (!frm.doc.task) { @@ -211,7 +205,7 @@ frappe.ui.form.on("Expense Claim", { } }); }, - + set_query_for_cost_center: function(frm) { frm.fields_dict["cost_center"].get_query = function() { return { @@ -262,7 +256,7 @@ frappe.ui.form.on("Expense Claim", { employee: frm.doc.employee }, callback: function(r, rt) { - + if(r.message) { $.each(r.message, function(i, d) { var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances"); diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2ca7a98cfb..17d68ef93e 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -525,4 +525,5 @@ erpnext.patches.v11_0.set_default_email_template_in_hr erpnext.patches.v10_0.taxes_issue_with_pos erpnext.patches.v10_1.transfer_subscription_to_auto_repeat erpnext.patches.v10_1.drop_old_subscription_records -erpnext.patches.v11_0.update_brand_in_item_price \ No newline at end of file +erpnext.patches.v11_0.update_brand_in_item_price +erpnext.patches.v11_0.create_default_success_action diff --git a/erpnext/patches/v11_0/create_default_success_action.py b/erpnext/patches/v11_0/create_default_success_action.py new file mode 100644 index 0000000000..29687d2692 --- /dev/null +++ b/erpnext/patches/v11_0/create_default_success_action.py @@ -0,0 +1,6 @@ +import frappe +from erpnext.setup.install import create_default_success_action + +def execute(): + frappe.reload_doc("core", "doctype", "success_action") + create_default_success_action() diff --git a/erpnext/patches/v9_0/fix_subscription_next_date.py b/erpnext/patches/v9_0/fix_subscription_next_date.py index 07af7129f6..ac9db31a37 100644 --- a/erpnext/patches/v9_0/fix_subscription_next_date.py +++ b/erpnext/patches/v9_0/fix_subscription_next_date.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe from frappe.utils import getdate -from erpnext.accounts.doctype.subscription.subscription import get_next_schedule_date +from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date def execute(): frappe.reload_doctype('Subscription') diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 92db12be91..63e85fd0ab 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -206,11 +206,6 @@ cur_frm.cscript['Declare Order Lost'] = function(){ } -cur_frm.cscript.on_submit = function(doc, cdt, cdn) { - if(cint(frappe.boot.notification_settings.quotation)) - cur_frm.email_doc(frappe.boot.notification_settings.quotation_message); -} - frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, cdn) { // enable tax_amount field if Actual }) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 20685deaac..9a2311d6b0 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -442,11 +442,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( frappe.ui.form.is_saving = false; } }); - }, - on_submit: function(doc, cdt, cdn) { - if(cint(frappe.boot.notification_settings.sales_order)) { - this.frm.email_doc(frappe.boot.notification_settings.sales_order_message); - } } }); $.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm})); \ No newline at end of file diff --git a/erpnext/setup/default_success_action.py b/erpnext/setup/default_success_action.py new file mode 100644 index 0000000000..e8494a1f96 --- /dev/null +++ b/erpnext/setup/default_success_action.py @@ -0,0 +1,26 @@ +from frappe import _ + +doctype_list = [ + 'Purchase Receipt', + 'Purchase Invoice', + 'Quotation', + 'Sales Order', + 'Delivery Note', + 'Sales Invoice' +] + +def get_message(doctype): + return _("{0} has been submitted successfully".format(_(doctype))) + +def get_first_success_message(doctype): + return _("{0} has been submitted successfully".format(_(doctype))) + +def get_default_success_action(): + return [{ + 'doctype': 'Success Action', + 'ref_doctype': doctype, + 'message': get_message(doctype), + 'first_success_message': get_first_success_message(doctype), + 'next_actions': 'new\nprint\nemail' + } for doctype in doctype_list] + diff --git a/erpnext/setup/doctype/notification_control/README.md b/erpnext/setup/doctype/notification_control/README.md deleted file mode 100644 index 3c411b7a82..0000000000 --- a/erpnext/setup/doctype/notification_control/README.md +++ /dev/null @@ -1 +0,0 @@ -Tool to automatically prompt sending of Email on Submission of various records. \ No newline at end of file diff --git a/erpnext/setup/doctype/notification_control/__init__.py b/erpnext/setup/doctype/notification_control/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/setup/doctype/notification_control/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js deleted file mode 100644 index 7f58ede1df..0000000000 --- a/erpnext/setup/doctype/notification_control/notification_control.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -frappe.ui.form.on("Notification Control", { - refresh: function(frm) { - frm.page.set_primary_action(__('Update'), function() { frm.events.set_message(frm); }); - }, - select_transaction: function(frm) { - frm.set_value("custom_message", frm.doc[frm.events.get_fieldname(frm)]); - }, - set_message: function(frm) { - if(frm.doc.select_transaction && frm.doc.select_transaction !== "") { - frm.set_value(frm.events.get_fieldname(frm), frm.doc.custom_message); - } - frm.save(); - }, - get_fieldname: function(frm) { - return frm.doc.select_transaction.replace(" ", "_").toLowerCase() + "_message"; - }, - after_save: function(frm) { - // update notification settings in current session - frappe.boot.notification_settings = frm.doc; - } -}); diff --git a/erpnext/setup/doctype/notification_control/notification_control.json b/erpnext/setup/doctype/notification_control/notification_control.json deleted file mode 100644 index fc3316ed01..0000000000 --- a/erpnext/setup/doctype/notification_control/notification_control.json +++ /dev/null @@ -1,566 +0,0 @@ -{ - "allow_copy": 1, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2012-07-12 23:29:45", - "custom": 0, - "description": "Send automatic emails to Contacts on Submitting transactions.", - "docstatus": 0, - "doctype": "DocType", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "description": "When any of the checked transactions are \"Submitted\", an email pop-up automatically opened to send an email to the associated \"Contact\" in that transaction, with the transaction as an attachment. The user may or may not send the email.", - "fieldname": "send_autonotification_for", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Prompt for Email on Submission of", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sales", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Sales", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": "50%", - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "50%" - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "quotation", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Quotation", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sales_order", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Sales Order", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "delivery_note", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Delivery Note", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sales_invoice", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Sales Invoice", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "purchase", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Purchase", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": "50%", - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "50%" - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "purchase_order", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Purchase Order", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "purchase_receipt", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Purchase Receipt", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "expense_claim", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Expense Claim", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "description": "Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.", - "fieldname": "customize_the_notification", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Customize the Notification", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "select_transaction", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Select Transaction", - "length": 0, - "no_copy": 0, - "options": "\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPurchase Order\nPurchase Receipt\nExpense Claim\nExpense Claim Approved\nExpense Claim Rejected", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "custom_message", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Custom Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "quotation_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Quotation Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sales_order_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Sales Order Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "delivery_note_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Delivery Note Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "sales_invoice_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Sales Invoice Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "purchase_order_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Purchase Order Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "purchase_receipt_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Purchase Receipt Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "expense_claim_approved_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Expense Claim Approved Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "expense_claim_rejected_message", - "fieldtype": "Text", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Expense Claim Rejected Message", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-envelope", - "idx": 1, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2016-06-01 13:06:06.981905", - "modified_by": "Administrator", - "module": "Setup", - "name": "Notification Control", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "sort_order": "ASC", - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py deleted file mode 100644 index c50bacac4c..0000000000 --- a/erpnext/setup/doctype/notification_control/notification_control.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe - -from frappe.model.document import Document - -class NotificationControl(Document): - def validate(self): - frappe.clear_cache() diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py index 8548f92dfa..03da833dec 100644 --- a/erpnext/setup/install.py +++ b/erpnext/setup/install.py @@ -5,6 +5,7 @@ from __future__ import print_function, unicode_literals import frappe from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS +from .default_success_action import get_default_success_action from frappe import _ from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to from frappe.custom.doctype.custom_field.custom_field import create_custom_field @@ -20,6 +21,7 @@ def after_install(): create_print_zero_amount_taxes_custom_field() add_all_roles_to("Administrator") create_default_cash_flow_mapper_templates() + create_default_success_action() frappe.db.commit() @@ -72,9 +74,13 @@ def create_print_zero_amount_taxes_custom_field(): def create_default_cash_flow_mapper_templates(): - mappers = DEFAULT_MAPPERS - - for mapper in mappers: + for mapper in DEFAULT_MAPPERS: if not frappe.db.exists('Cash Flow Mapper', mapper['section_name']): doc = frappe.get_doc(mapper) doc.insert(ignore_permissions=True) + +def create_default_success_action(): + for success_action in get_default_success_action(): + if not frappe.db.exists('Success Action', success_action.get("ref_doctype")): + doc = frappe.get_doc(success_action) + doc.insert(ignore_permissions=True) diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py index 08b8a06013..f5b1e984f7 100644 --- a/erpnext/setup/setup_wizard/operations/defaults_setup.py +++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py @@ -53,12 +53,6 @@ def set_default_settings(args): buying_settings.allow_multiple_items = 1 buying_settings.save() - notification_control = frappe.get_doc("Notification Control") - notification_control.quotation = 1 - notification_control.sales_invoice = 1 - notification_control.purchase_order = 1 - notification_control.save() - hr_settings = frappe.get_doc("HR Settings") hr_settings.emp_created_by = "Naming Series" hr_settings.leave_approval_notification_template = "Leave Approval Notification" diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index f22c70cdff..8c43306527 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -25,9 +25,6 @@ def boot_session(bootinfo): bootinfo.sysdefaults.quotation_valid_till = cint(frappe.db.get_single_value('Selling Settings', 'default_valid_till')) - bootinfo.notification_settings = frappe.get_doc("Notification Control", - "Notification Control") - # if no company, show a dialog box to create a new company bootinfo.customer_count = frappe.db.sql("""select count(*) from tabCustomer""")[0][0] diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index e6029aa4ea..ba0268eea6 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -66,11 +66,6 @@ frappe.ui.form.on("Delivery Note", { }, print_without_amount: function(frm) { erpnext.stock.delivery_note.set_print_hide(frm.doc); - }, - on_submit: function(frm) { - if(cint(frappe.boot.notification_settings.delivery_note)) { - frm.email_doc(frappe.boot.notification_settings.delivery_note_message); - } } }); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 791b2532f7..034ea1ebb6 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -213,11 +213,6 @@ cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt } } -cur_frm.cscript.on_submit = function(doc, cdt, cdn) { - if(cint(frappe.boot.notification_settings.purchase_receipt)) - cur_frm.email_doc(frappe.boot.notification_settings.purchase_receipt_message); -} - frappe.provide("erpnext.buying"); frappe.ui.form.on("Purchase Receipt", "is_subcontracted", function(frm) { diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 0c2b6c5877..d3769a23bd 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -13,12 +13,6 @@ from six import string_types class UOMMustBeIntegerError(frappe.ValidationError): pass class TransactionBase(StatusUpdater): - def load_notification_message(self): - dt = self.doctype.lower().replace(" ", "_") - if int(frappe.db.get_value("Notification Control", None, dt) or 0): - self.set("__notification_message", - frappe.db.get_value("Notification Control", None, dt + "_message")) - def validate_posting_time(self): # set Edit Posting Date and Time to 1 while data import if frappe.flags.in_import and self.posting_date: