diff --git a/frappe/__init__.py b/frappe/__init__.py
index 9dd5cc427b..bdc8232ea3 100644
--- a/frappe/__init__.py
+++ b/frappe/__init__.py
@@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json
from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template
-__version__ = '10.1.45'
+__version__ = '10.1.46'
__title__ = "Frappe Framework"
local = Local()
diff --git a/frappe/core/doctype/communication/comment.py b/frappe/core/doctype/communication/comment.py
index 2c7a4bd122..0ceb93219c 100644
--- a/frappe/core/doctype/communication/comment.py
+++ b/frappe/core/doctype/communication/comment.py
@@ -94,7 +94,7 @@ def notify_mentions(doc):
subject = _("{0} mentioned you in a comment").format(sender_fullname)
- recipients = [frappe.db.get_value("User", {"enabled": 1, "name": name, "user_type": "System User"})
+ recipients = [frappe.db.get_value("User", {"enabled": 1, "name": name, "user_type": "System User"}, "email")
for name in mentions]
frappe.sendmail(
recipients=recipients,
diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py
index b82b012e23..1fa9f75156 100644
--- a/frappe/core/doctype/doctype/doctype.py
+++ b/frappe/core/doctype/doctype/doctype.py
@@ -55,6 +55,7 @@ class DocType(Document):
self.permissions = []
self.scrub_field_names()
+ self.scrub_options_in_select()
self.set_default_in_list_view()
self.validate_series()
self.validate_document_type()
@@ -177,6 +178,17 @@ class DocType(Document):
# fieldnames should be lowercase
d.fieldname = d.fieldname.lower()
+ def scrub_options_in_select(self):
+ """Strip options for whitespaces"""
+ for field in self.fields:
+ if field.fieldtype == "Select" and field.options is not None:
+ new_options = ""
+ for option in field.options.split("\n"):
+ new_options += option.strip()
+ new_options += "\n"
+ new_options.rstrip("\n")
+ field.options = new_options
+
def validate_series(self, autoname=None, name=None):
"""Validate if `autoname` property is correctly set."""
if not autoname: autoname = self.autoname
@@ -396,9 +408,9 @@ class DocType(Document):
# a DocType's name should not start with a number or underscore
# and should only contain letters, numbers and underscore
if six.PY2:
- is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name)
+ is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w ]+$", name)
else:
- is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, flags = re.ASCII)
+ is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w ]+$", name, flags = re.ASCII)
if not is_a_valid_name:
frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers, spaces and underscores"), frappe.NameError)
diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py
index cb85399fb9..c4378dbb8c 100644
--- a/frappe/core/doctype/user/user.py
+++ b/frappe/core/doctype/user/user.py
@@ -901,10 +901,10 @@ def notify_admin_access_to_system_manager(login_manager=None):
def extract_mentions(txt):
"""Find all instances of @name in the string.
The mentions will be separated by non-word characters or may appear at the start of the string"""
+ txt = txt.replace("
", "
")
txt = re.sub(r'(<[a-zA-Z\/][^>]*>)', '', txt)
return re.findall(r'(?:[^\w\.\-\@]|^)@([\w\.\-\@]*)', txt)
-
def handle_password_test_fail(result):
suggestions = result['feedback']['suggestions'][0] if result['feedback']['suggestions'] else ''
warning = result['feedback']['warning'] if 'warning' in result['feedback'] else ''
diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.py b/frappe/email/doctype/auto_email_report/auto_email_report.py
index 01b8566982..4942d98375 100644
--- a/frappe/email/doctype/auto_email_report/auto_email_report.py
+++ b/frappe/email/doctype/auto_email_report/auto_email_report.py
@@ -108,6 +108,7 @@ class AutoEmailReport(Document):
new_row = []
out.append(new_row)
for df in columns:
+ if not row.get(df.fieldname): continue
new_row.append(frappe.format(row[df.fieldname], df, row))
return out
diff --git a/frappe/email/doctype/email_alert/email_alert.js b/frappe/email/doctype/email_alert/email_alert.js
index 3f7423bc1b..a901b257cb 100755
--- a/frappe/email/doctype/email_alert/email_alert.js
+++ b/frappe/email/doctype/email_alert/email_alert.js
@@ -1,3 +1,13 @@
+this.frm.add_fetch('sender', 'email_id', 'sender_email');
+
+this.frm.fields_dict.sender.get_query = function(){
+ return {
+ filters: {
+ 'enable_outgoing': 1
+ }
+ }
+};
+
frappe.email_alert = {
setup_fieldname_select: function(frm) {
// get the doctype to update fields
diff --git a/frappe/email/doctype/email_alert/email_alert.json b/frappe/email/doctype/email_alert/email_alert.json
index fd3763cd14..860bfbd46d 100755
--- a/frappe/email/doctype/email_alert/email_alert.json
+++ b/frappe/email/doctype/email_alert/email_alert.json
@@ -379,6 +379,68 @@
"set_only_once": 0,
"unique": 0
},
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "sender",
+ "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": "Sender",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Email Account",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "sender_email",
+ "fieldtype": "Data",
+ "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": "Sender Email",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Email",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@@ -871,7 +933,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-09-26 20:10:00.061780",
+ "modified": "2018-07-30 14:32:02.179599",
"modified_by": "Administrator",
"module": "Email",
"name": "Email Alert",
diff --git a/frappe/email/doctype/email_alert/email_alert.py b/frappe/email/doctype/email_alert/email_alert.py
index cfd081d7ae..1da959956f 100755
--- a/frappe/email/doctype/email_alert/email_alert.py
+++ b/frappe/email/doctype/email_alert/email_alert.py
@@ -105,6 +105,7 @@ def get_context(context):
def send(self, doc):
'''Build recipients and send email alert'''
+ from email.utils import formataddr
def get_attachment(doc):
""" check print settings are attach the pdf """
@@ -126,6 +127,7 @@ def get_context(context):
context = get_context(doc)
recipients = []
+ sender = ""
for recipient in self.recipients:
if recipient.condition:
@@ -157,6 +159,9 @@ def get_context(context):
context = {"doc": doc, "alert": self, "comments": None}
+ if self.sender:
+ sender = formataddr((self.sender, self.sender_email))
+
if self.is_standard:
self.load_standard_properties(context)
@@ -170,6 +175,7 @@ def get_context(context):
frappe.sendmail(recipients=recipients, subject=subject,
message= frappe.render_template(self.message, context),
+ sender = sender,
reference_doctype = doc.doctype,
reference_name = doc.name,
attachments = attachments,
diff --git a/frappe/geo/country_info.json b/frappe/geo/country_info.json
index f3a251f72d..41b8b3de81 100644
--- a/frappe/geo/country_info.json
+++ b/frappe/geo/country_info.json
@@ -2554,7 +2554,7 @@
"currency": "USD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
- "smallest_currency_fraction_value": 0.05,
+ "smallest_currency_fraction_value": 0.01,
"currency_name": "US Dollar",
"currency_symbol": "$",
"date_format": "mm-dd-yyyy",
diff --git a/frappe/patches.txt b/frappe/patches.txt
index 3c8884b52b..7025c7fafb 100644
--- a/frappe/patches.txt
+++ b/frappe/patches.txt
@@ -8,13 +8,13 @@ frappe.patches.v7_2.remove_in_filter
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-09-22
execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2017-03-03
execute:frappe.reload_doc('core', 'doctype', 'docperm') #2017-03-03
+frappe.patches.v8_0.drop_is_custom_from_docperm
execute:frappe.reload_doc('core', 'doctype', 'module_def') #2017-09-22
execute:frappe.reload_doc('core', 'doctype', 'version') #2017-04-01
execute:frappe.reload_doc('core', 'doctype', 'activity_log')
frappe.patches.v7_1.rename_scheduler_log_to_error_log
frappe.patches.v6_1.rename_file_data
frappe.patches.v7_0.re_route #2016-06-27
-frappe.patches.v8_0.drop_is_custom_from_docperm
frappe.patches.v8_0.update_records_in_global_search #11-05-2017
frappe.patches.v8_0.update_published_in_global_search
execute:frappe.reload_doc('core', 'doctype', 'custom_docperm')
@@ -203,4 +203,5 @@ execute:frappe.delete_doc('Page', 'data-import-tool', ignore_missing=True)
frappe.patches.v10_0.reload_countries_and_currencies
frappe.patches.v10_0.set_no_copy_to_workflow_state
frappe.patches.v10_0.increase_single_table_column_length
-frappe.patches.v10_0.set_default_locking_time
\ No newline at end of file
+frappe.patches.v10_0.set_default_locking_time
+frappe.patches.v10_0.modify_smallest_currency_fraction
\ No newline at end of file
diff --git a/frappe/patches/v10_0/modify_smallest_currency_fraction.py b/frappe/patches/v10_0/modify_smallest_currency_fraction.py
new file mode 100644
index 0000000000..c9ae477359
--- /dev/null
+++ b/frappe/patches/v10_0/modify_smallest_currency_fraction.py
@@ -0,0 +1,7 @@
+# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
+# MIT License. See license.txt
+
+import frappe
+
+def execute():
+ frappe.db.set_value('Currency', 'USD', 'smallest_currency_fraction_value', '0.01')
\ No newline at end of file
diff --git a/frappe/public/js/frappe/form/footer/timeline.js b/frappe/public/js/frappe/form/footer/timeline.js
index 7c760b80a3..d93a9ae804 100644
--- a/frappe/public/js/frappe/form/footer/timeline.js
+++ b/frappe/public/js/frappe/form/footer/timeline.js
@@ -118,7 +118,6 @@ frappe.ui.form.Timeline = Class.extend({
this.wrapper.toggle(true);
this.list.empty();
this.comment_area.val('');
-
var communications = this.get_communications(true);
communications
@@ -178,7 +177,6 @@ frappe.ui.form.Timeline = Class.extend({
} else {
var $edit_btn = $(this);
var content = $timeline_item.find('.timeline-item-content').html();
-
$edit_btn
.text("Save")
.find('i')
@@ -298,7 +296,6 @@ frappe.ui.form.Timeline = Class.extend({
c.original_content = c.content;
c.content = frappe.utils.toggle_blockquote(c.content);
}
-
if(!frappe.utils.is_html(c.content)) {
c.content_html = frappe.markdown(__(c.content));
} else {
@@ -312,7 +309,17 @@ frappe.ui.form.Timeline = Class.extend({
// avoid adding tag a 2nd time
!c.content_html.match(/(^|\W)(@[^\s]+)<\/b>/)
) {
- c.content_html = c.content_html.replace(/(^|\W)(@[^\s]+)/g, "$1$2");
+ /*
+ Replace the email ids by only displaying the string which
+ occurs before the second `@` to enhance the mentions.
+ Eg.
+ @abc@a-example.com will be converted to
+ @abc with the below line of code.
+ */
+
+ c.content_html = c.content_html.replace(/(<[a][^>]*>)/g, "");
+ // bold the @mentions
+ c.content_html = c.content_html.replace(/(@[^\s@]*)@[^\s@|<]*/g, "$1");
}
if (this.is_communication_or_comment(c)) {
@@ -657,7 +664,7 @@ frappe.ui.form.Timeline = Class.extend({
var valid_users = Object.keys(frappe.boot.user_info)
.filter(user => !["Administrator", "Guest"].includes(user));
- return valid_users.map(user => frappe.boot.user_info[user].name);
+ return valid_users.map(user => frappe.boot.user_info[user].email);
},
setup_comment_like: function() {