From 4844fbb92c6ce35edca580def989320715a01007 Mon Sep 17 00:00:00 2001 From: ci2014 Date: Fri, 14 Sep 2018 00:53:11 +0200 Subject: [PATCH 1/9] Fix recipients by document field When having multiple documents in the loop, email_by_document_field would be overridden by the mail address(es). In my case every trigger would only send one email, because for the doc following on the first one, the email_by_document_field would contain mail addresses instead of the field name. Prefixing with tmp_ solves the problem, because we only need the key in that lines. --- frappe/email/doctype/email_alert/email_alert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/email_alert/email_alert.py b/frappe/email/doctype/email_alert/email_alert.py index 1da959956f..1bf867bbce 100755 --- a/frappe/email/doctype/email_alert/email_alert.py +++ b/frappe/email/doctype/email_alert/email_alert.py @@ -135,8 +135,8 @@ def get_context(context): continue if recipient.email_by_document_field: if validate_email_add(doc.get(recipient.email_by_document_field)): - recipient.email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") - recipients = recipients + recipient.email_by_document_field.split("\n") + recipient.tmp_email_by_document_field = doc.get(recipient.email_by_document_field).replace(",", "\n") + recipients = recipients + recipient.tmp_email_by_document_field.split("\n") # else: # print "invalid email" From 50915f317762d0eb8b8974c57a484a935fba28b0 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 24 Sep 2018 11:30:32 +0530 Subject: [PATCH 2/9] fix: Handle empty json in Report (#6127) --- frappe/core/doctype/report/report.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/report/report.py b/frappe/core/doctype/report/report.py index d11d7f0a51..a7b1c4d4dc 100644 --- a/frappe/core/doctype/report/report.py +++ b/frappe/core/doctype/report/report.py @@ -73,6 +73,9 @@ class Report(Document): return True def update_report_json(self): + if not self.json: + self.json = '{}' + if self.json: data = json.loads(self.json) data["add_total_row"] = self.add_total_row @@ -121,7 +124,15 @@ class Report(Document): else: # standard report params = json.loads(self.json) - columns = params.get('columns') + + if params.get('columns'): + columns = params.get('columns') + else: + columns = [['name', self.ref_doctype]] + for df in frappe.get_meta(self.ref_doctype).fields: + if df.in_list_view: + columns.append([df.fieldname, self.ref_doctype]) + _filters = params.get('filters') or [] if filters: @@ -135,7 +146,11 @@ class Report(Document): # sort by is saved as DocType.fieldname, covert it to sql return '`tab{0}`.`{1}`'.format(*parts) - order_by = _format(params.get('sort_by').split('.')) + ' ' + params.get('sort_order') + if params.get('sort_by'): + order_by = _format(params.get('sort_by').split('.')) + ' ' + params.get('sort_order') + else: + order_by = _format(self.ref_doctype, 'modified') + ' desc' + if params.get('sort_by_next'): order_by += ', ' + _format(params.get('sort_by_next').split('.')) + ' ' + params.get('sort_order_next') From bea46dc45cbd1d2d319c73692cd6c8332c9d062c Mon Sep 17 00:00:00 2001 From: gshmu Date: Mon, 24 Sep 2018 15:29:37 +0800 Subject: [PATCH 3/9] list clear, unselect list-select-all (#6088) --- frappe/public/js/frappe/ui/base_list.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/public/js/frappe/ui/base_list.js b/frappe/public/js/frappe/ui/base_list.js index 3a239f5bc0..7999b1b164 100644 --- a/frappe/public/js/frappe/ui/base_list.js +++ b/frappe/public/js/frappe/ui/base_list.js @@ -258,6 +258,7 @@ frappe.ui.BaseList = Class.extend({ clear: function () { this.data = []; + this.wrapper.find('.list-select-all').prop('checked', false); this.wrapper.find('.result-list').empty(); this.wrapper.find('.result').show(); this.wrapper.find('.no-result').hide(); From a8423dd782499f886c085975a73d38a6aaa55521 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 25 Sep 2018 15:37:26 +0530 Subject: [PATCH 4/9] [Fix] Email not sending if reciepients is blank because of reciepients is unsubscribed (#6136) --- frappe/email/queue.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frappe/email/queue.py b/frappe/email/queue.py index f06bfa69eb..8f5a28efac 100755 --- a/frappe/email/queue.py +++ b/frappe/email/queue.py @@ -89,6 +89,13 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content= recipients = [r for r in list(set(recipients)) if r and r not in unsubscribed] + if cc: + cc = [r for r in list(set(cc)) if r and r not in unsubscribed] + + if not recipients and not cc: + # Recipients may have been unsubscribed, exit quietly + return + email_text_context = text_content should_append_unsubscribe = (add_unsubscribe_link From a19525e695adba66d2cc35f8b801cbf683a5fcd8 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 25 Sep 2018 15:40:18 +0530 Subject: [PATCH 5/9] fix(setup_global_help): allow utf-8 in filename (#6132) - fixed issue with setting up global help. Setting up global help used to fail when the filenames were in any language other than english, due to improper encoding. Used frappe.safe_decode to solve the issue Signed-off-by: Ameya Shenoy --- frappe/utils/help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/utils/help.py b/frappe/utils/help.py index c76e977dd8..5549b17d19 100644 --- a/frappe/utils/help.py +++ b/frappe/utils/help.py @@ -245,7 +245,7 @@ class HelpDatabase(object): links_html = "