-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Delivery Settings + improve 'Notify Customers' functionality (#15322
) * Add Delivery Settings + improve 'Notify Customers' functionality * Minor improvements * Add patch to create a default dispatch notification template * Fix travis errors
- Loading branch information
Showing
17 changed files
with
520 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
erpnext/patches/v11_0/add_default_dispatch_notification_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
|
||
import frappe | ||
from frappe import _ | ||
|
||
|
||
def execute(): | ||
frappe.reload_doc("email", "doctype", "email_template") | ||
frappe.reload_doc("stock", "doctype", "delivery_settings") | ||
|
||
if not frappe.db.exists("Email Template", _("Dispatch Notification")): | ||
base_path = frappe.get_app_path("erpnext", "stock", "doctype") | ||
response = frappe.read_file(os.path.join(base_path, "delivery_trip/dispatch_notification_template.html")) | ||
|
||
frappe.get_doc({ | ||
"doctype": "Email Template", | ||
"name": _("Dispatch Notification"), | ||
"response": response, | ||
"subject": _("Your order is out for delivery!"), | ||
"owner": frappe.session.user, | ||
}).insert(ignore_permissions=True) | ||
|
||
delivery_settings = frappe.get_doc("Delivery Settings") | ||
delivery_settings.dispatch_template = _("Dispatch Notification") | ||
delivery_settings.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors | ||
// For license information, please see license.txt | ||
|
||
frappe.ui.form.on('Delivery Settings', { | ||
refresh: function(frm) { | ||
|
||
} | ||
}); |
194 changes: 194 additions & 0 deletions
194
erpnext/stock/doctype/delivery_settings/delivery_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
{ | ||
"allow_copy": 0, | ||
"allow_guest_to_view": 0, | ||
"allow_import": 0, | ||
"allow_rename": 0, | ||
"beta": 0, | ||
"creation": "2018-09-04 23:01:34.458550", | ||
"custom": 0, | ||
"docstatus": 0, | ||
"doctype": "DocType", | ||
"document_type": "", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"fields": [ | ||
{ | ||
"allow_bulk_edit": 0, | ||
"allow_in_quick_entry": 0, | ||
"allow_on_submit": 0, | ||
"bold": 0, | ||
"collapsible": 0, | ||
"columns": 0, | ||
"fieldname": "sb_dispatch", | ||
"fieldtype": "Section Break", | ||
"hidden": 0, | ||
"ignore_user_permissions": 0, | ||
"ignore_xss_filter": 0, | ||
"in_filter": 0, | ||
"in_global_search": 0, | ||
"in_list_view": 0, | ||
"in_standard_filter": 0, | ||
"label": "Dispatch Settings", | ||
"length": 0, | ||
"no_copy": 0, | ||
"permlevel": 0, | ||
"precision": "", | ||
"print_hide": 0, | ||
"print_hide_if_no_value": 0, | ||
"read_only": 0, | ||
"remember_last_selected_value": 0, | ||
"report_hide": 0, | ||
"reqd": 0, | ||
"search_index": 0, | ||
"set_only_once": 0, | ||
"translatable": 0, | ||
"unique": 0 | ||
}, | ||
{ | ||
"allow_bulk_edit": 0, | ||
"allow_in_quick_entry": 0, | ||
"allow_on_submit": 0, | ||
"bold": 0, | ||
"collapsible": 0, | ||
"columns": 0, | ||
"fieldname": "dispatch_template", | ||
"fieldtype": "Link", | ||
"hidden": 0, | ||
"ignore_user_permissions": 0, | ||
"ignore_xss_filter": 0, | ||
"in_filter": 0, | ||
"in_global_search": 0, | ||
"in_list_view": 0, | ||
"in_standard_filter": 0, | ||
"label": "Dispatch Notification Template", | ||
"length": 0, | ||
"no_copy": 0, | ||
"options": "Email Template", | ||
"permlevel": 0, | ||
"precision": "", | ||
"print_hide": 0, | ||
"print_hide_if_no_value": 0, | ||
"read_only": 0, | ||
"remember_last_selected_value": 0, | ||
"report_hide": 0, | ||
"reqd": 0, | ||
"search_index": 0, | ||
"set_only_once": 0, | ||
"translatable": 0, | ||
"unique": 0 | ||
}, | ||
{ | ||
"allow_bulk_edit": 0, | ||
"allow_in_quick_entry": 0, | ||
"allow_on_submit": 0, | ||
"bold": 0, | ||
"collapsible": 0, | ||
"columns": 0, | ||
"depends_on": "send_with_attachment", | ||
"description": "Leave blank to use the standard Delivery Note format", | ||
"fieldname": "dispatch_attachment", | ||
"fieldtype": "Link", | ||
"hidden": 0, | ||
"ignore_user_permissions": 0, | ||
"ignore_xss_filter": 0, | ||
"in_filter": 0, | ||
"in_global_search": 0, | ||
"in_list_view": 0, | ||
"in_standard_filter": 0, | ||
"label": "Dispatch Notification Attachment", | ||
"length": 0, | ||
"no_copy": 0, | ||
"options": "Print Format", | ||
"permlevel": 0, | ||
"precision": "", | ||
"print_hide": 0, | ||
"print_hide_if_no_value": 0, | ||
"read_only": 0, | ||
"remember_last_selected_value": 0, | ||
"report_hide": 0, | ||
"reqd": 0, | ||
"search_index": 0, | ||
"set_only_once": 0, | ||
"translatable": 0, | ||
"unique": 0 | ||
}, | ||
{ | ||
"allow_bulk_edit": 0, | ||
"allow_in_quick_entry": 0, | ||
"allow_on_submit": 0, | ||
"bold": 0, | ||
"collapsible": 0, | ||
"columns": 0, | ||
"fieldname": "send_with_attachment", | ||
"fieldtype": "Check", | ||
"hidden": 0, | ||
"ignore_user_permissions": 0, | ||
"ignore_xss_filter": 0, | ||
"in_filter": 0, | ||
"in_global_search": 0, | ||
"in_list_view": 0, | ||
"in_standard_filter": 0, | ||
"label": "Send with Attachment", | ||
"length": 0, | ||
"no_copy": 0, | ||
"permlevel": 0, | ||
"precision": "", | ||
"print_hide": 0, | ||
"print_hide_if_no_value": 0, | ||
"read_only": 0, | ||
"remember_last_selected_value": 0, | ||
"report_hide": 0, | ||
"reqd": 0, | ||
"search_index": 0, | ||
"set_only_once": 0, | ||
"translatable": 0, | ||
"unique": 0 | ||
} | ||
], | ||
"has_web_view": 0, | ||
"hide_heading": 0, | ||
"hide_toolbar": 0, | ||
"idx": 0, | ||
"image_view": 0, | ||
"in_create": 0, | ||
"is_submittable": 0, | ||
"issingle": 1, | ||
"istable": 0, | ||
"max_attachments": 0, | ||
"modified": "2018-09-05 00:16:23.569855", | ||
"modified_by": "Administrator", | ||
"module": "Stock", | ||
"name": "Delivery Settings", | ||
"name_case": "", | ||
"owner": "Administrator", | ||
"permissions": [ | ||
{ | ||
"amend": 0, | ||
"cancel": 0, | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 0, | ||
"if_owner": 0, | ||
"import": 0, | ||
"permlevel": 0, | ||
"print": 1, | ||
"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, | ||
"show_name_in_global_search": 0, | ||
"sort_field": "modified", | ||
"sort_order": "DESC", | ||
"track_changes": 1, | ||
"track_seen": 0, | ||
"track_views": 0 | ||
} |
10 changes: 10 additions & 0 deletions
10
erpnext/stock/doctype/delivery_settings/delivery_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors | ||
# For license information, please see license.txt | ||
|
||
from __future__ import unicode_literals | ||
import frappe | ||
from frappe.model.document import Document | ||
|
||
class DeliverySettings(Document): | ||
pass |
23 changes: 23 additions & 0 deletions
23
erpnext/stock/doctype/delivery_settings/test_delivery_settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable */ | ||
// rename this file from _test_[name] to test_[name] to activate | ||
// and remove above this line | ||
|
||
QUnit.test("test: Delivery Settings", function (assert) { | ||
let done = assert.async(); | ||
|
||
// number of asserts | ||
assert.expect(1); | ||
|
||
frappe.run_serially([ | ||
// insert a new Delivery Settings | ||
() => frappe.tests.make('Delivery Settings', [ | ||
// values to be set | ||
{key: 'value'} | ||
]), | ||
() => { | ||
assert.equal(cur_frm.doc.key, 'value'); | ||
}, | ||
() => done() | ||
]); | ||
|
||
}); |
10 changes: 10 additions & 0 deletions
10
erpnext/stock/doctype/delivery_settings/test_delivery_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors | ||
# See license.txt | ||
from __future__ import unicode_literals | ||
|
||
import frappe | ||
import unittest | ||
|
||
class TestDeliverySettings(unittest.TestCase): | ||
pass |
Oops, something went wrong.