From 8c8385a37b0e371d556e199be755c6b4a9411081 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 19 Jul 2017 12:32:55 +0530 Subject: [PATCH 1/6] [Fix] Calender view broken if filters has not applied (#3737) --- frappe/desk/reportview.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frappe/desk/reportview.py b/frappe/desk/reportview.py index ae5f378aa2..fbb363300f 100644 --- a/frappe/desk/reportview.py +++ b/frappe/desk/reportview.py @@ -335,10 +335,10 @@ def build_match_conditions(doctype, as_condition=True): return match_conditions def get_filters_cond(doctype, filters, conditions, ignore_permissions=None, with_match_conditions=False): - if filters: - if isinstance(filters, basestring): - filters = json.loads(filters) + if isinstance(filters, basestring): + filters = json.loads(filters) + if filters: flt = filters if isinstance(filters, dict): filters = filters.items() @@ -363,4 +363,3 @@ def get_filters_cond(doctype, filters, conditions, ignore_permissions=None, with else: cond = '' return cond - From 5ed241d81a1604f95d0a1c9366fdceb6fbcdec37 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 19 Jul 2017 13:49:23 +0530 Subject: [PATCH 2/6] Multiple filter area fix (#3738) --- frappe/public/js/frappe/ui/filters/filters.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/ui/filters/filters.js b/frappe/public/js/frappe/ui/filters/filters.js index eedbd0f07e..0f9fba59ec 100644 --- a/frappe/public/js/frappe/ui/filters/filters.js +++ b/frappe/public/js/frappe/ui/filters/filters.js @@ -11,9 +11,7 @@ frappe.ui.FilterList = Class.extend({ this.set_events(); }, make: function() { - var me = this; - - this.wrapper.find('.show_filters').remove(); + this.wrapper.find('.show_filters, .filter_area').remove(); this.wrapper.append(`
From d230021134ccfd1a5fc9f365b3393f8afa3aa701 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Wed, 19 Jul 2017 14:50:43 +0530 Subject: [PATCH 3/6] [notif] fix alignment (#3734) --- frappe/public/css/common.css | 1 + frappe/public/css/desk.css | 1 + frappe/public/css/website.css | 1 + frappe/public/js/frappe/ui/toolbar/notifications.js | 11 +++++++---- frappe/public/less/common.less | 1 + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frappe/public/css/common.css b/frappe/public/css/common.css index e1883eed00..3aa13bef79 100644 --- a/frappe/public/css/common.css +++ b/frappe/public/css/common.css @@ -89,6 +89,7 @@ kbd { } .dropdown-menu > li > a { padding: 14px; + white-space: normal; } .dropdown-menu { min-width: 200px; diff --git a/frappe/public/css/desk.css b/frappe/public/css/desk.css index ebe34f0de2..8ea2c5650f 100644 --- a/frappe/public/css/desk.css +++ b/frappe/public/css/desk.css @@ -89,6 +89,7 @@ kbd { } .dropdown-menu > li > a { padding: 14px; + white-space: normal; } .dropdown-menu { min-width: 200px; diff --git a/frappe/public/css/website.css b/frappe/public/css/website.css index a02316f7b9..9a92bccf38 100644 --- a/frappe/public/css/website.css +++ b/frappe/public/css/website.css @@ -89,6 +89,7 @@ kbd { } .dropdown-menu > li > a { padding: 14px; + white-space: normal; } .dropdown-menu { min-width: 200px; diff --git a/frappe/public/js/frappe/ui/toolbar/notifications.js b/frappe/public/js/frappe/ui/toolbar/notifications.js index 465edf02a0..00149224cd 100644 --- a/frappe/public/js/frappe/ui/toolbar/notifications.js +++ b/frappe/public/js/frappe/ui/toolbar/notifications.js @@ -24,7 +24,7 @@ frappe.ui.notifications = { this.boot_info = frappe.boot.notification_info; let defaults = ["Comment", "ToDo", "Event"]; - this.get_counts(this.boot_info.open_count_doctype, 0, defaults); + this.get_counts(this.boot_info.open_count_doctype, 1, defaults); this.get_counts(this.boot_info.open_count_other, 1); // Target counts are stored for docs per doctype @@ -49,16 +49,19 @@ frappe.ui.notifications = { }, get_counts: function(map, divide, keys, excluded = [], target = false) { + let empty_map = 1; keys = keys ? keys : Object.keys(map).sort().filter(e => !excluded.includes(e)); keys.map(key => { let doc_dt = (map.doctypes) ? map.doctypes[key] : undefined; - if(map[key] > 0) { + if(map[key] > 0 || target) { this.add_notification(key, map[key], doc_dt, target); + empty_map = 0; } }); - if(divide) + if(divide && !empty_map) { this.dropdown.append($('
  • ')); + } }, add_notification: function(name, value, doc_dt, target = false) { @@ -68,7 +71,7 @@ frappe.ui.notifications = { ${value} `) : $(`
  • ${label} + data-doc="${name}">${label}
    diff --git a/frappe/public/less/common.less b/frappe/public/less/common.less index 5c5238d30b..a97bc3f6dc 100644 --- a/frappe/public/less/common.less +++ b/frappe/public/less/common.less @@ -101,6 +101,7 @@ kbd { // dropdowns .dropdown-menu > li > a { padding: 14px; + white-space: normal; } .dropdown-menu { From 7029f8b8fdc99de0e832c83c458f33c30134e3fa Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 20 Jul 2017 10:26:04 +0530 Subject: [PATCH 4/6] [wiz][fix] set defaults on add more (#3745) --- frappe/public/js/frappe/form/layout.js | 12 ------------ frappe/public/js/frappe/ui/field_group.js | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index c6458d8ee0..5ba03bb6ac 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -263,18 +263,6 @@ frappe.ui.form.Layout = Class.extend({ } }, - refresh_fields: function(fields) { - let fieldnames = fields.map((field) => { - if(field.label) return field.label; - }); - - this.fields_list.map(fieldobj => { - if(fieldnames.includes(fieldobj._label)) { - fieldobj.refresh(); - } - }); - }, - refresh_section_count: function() { this.wrapper.find(".section-count-label:visible").each(function(i) { $(this).html(i+1); diff --git a/frappe/public/js/frappe/ui/field_group.js b/frappe/public/js/frappe/ui/field_group.js index b708b76b87..5df46c55ef 100644 --- a/frappe/public/js/frappe/ui/field_group.js +++ b/frappe/public/js/frappe/ui/field_group.js @@ -45,6 +45,20 @@ frappe.ui.FieldGroup = frappe.ui.form.Layout.extend({ this.render(fields); this.refresh_fields(fields); }, + refresh_fields: function(fields) { + let fieldnames = fields.map((field) => { + if(field.fieldname) return field.fieldname; + }); + + this.fields_list.map(fieldobj => { + if(fieldnames.includes(fieldobj.df.fieldname)) { + fieldobj.refresh(); + if(fieldobj.df["default"]) { + fieldobj.set_input(fieldobj.df["default"]); + } + } + }); + }, first_button: false, catch_enter_as_submit: function() { var me = this; From 124a326ae8db0f1f2251c828d2d1851cf5212af1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 20 Jul 2017 11:39:18 +0530 Subject: [PATCH 5/6] Fixed ajax count after server request failed (#3746) --- frappe/public/js/frappe/request.js | 110 +++++++++++++++-------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/frappe/public/js/frappe/request.js b/frappe/public/js/frappe/request.js index 1100d86f26..b6671fea7d 100644 --- a/frappe/public/js/frappe/request.js +++ b/frappe/public/js/frappe/request.js @@ -158,23 +158,29 @@ frappe.request.call = function(opts) { return $.ajax(ajax_args) .done(function(data, textStatus, xhr) { - if(typeof data === "string") data = JSON.parse(data); + try { + if(typeof data === "string") data = JSON.parse(data); - // sync attached docs - if(data.docs || data.docinfo) { - frappe.model.sync(data); - } + // sync attached docs + if(data.docs || data.docinfo) { + frappe.model.sync(data); + } - // sync translated messages - if(data.__messages) { - $.extend(frappe._messages, data.__messages); - } + // sync translated messages + if(data.__messages) { + $.extend(frappe._messages, data.__messages); + } - // callbacks - var status_code_handler = statusCode[xhr.statusCode().status]; - if (status_code_handler) { - status_code_handler(data, xhr); + // callbacks + var status_code_handler = statusCode[xhr.statusCode().status]; + if (status_code_handler) { + status_code_handler(data, xhr); + } + } catch(e) { + console.log("Unable to handle response"); + console.trace(e); } + }) .always(function(data, textStatus, xhr) { try { @@ -208,7 +214,7 @@ frappe.request.call = function(opts) { // call execute serverside request frappe.request.prepare = function(opts) { frappe.request.ajax_count++; - + $("body").attr("data-ajax-state", "triggered"); // btn indicator @@ -247,53 +253,51 @@ frappe.request.cleanup = function(opts, r) { // un-freeze page if(opts.freeze) frappe.dom.unfreeze(); + + if(r) { - if(!r) { - return; - } - - // session expired? - Guest has no business here! - if(r.session_expired || frappe.get_cookie("sid")==="Guest") { - frappe.app.handle_session_expired(); - return; - } + // session expired? - Guest has no business here! + if(r.session_expired || frappe.get_cookie("sid")==="Guest") { + frappe.app.handle_session_expired(); + return; + } - // show messages - if(r._server_messages && !opts.silent) { - r._server_messages = JSON.parse(r._server_messages); - frappe.hide_msgprint(); - frappe.msgprint(r._server_messages); - } + // show messages + if(r._server_messages && !opts.silent) { + r._server_messages = JSON.parse(r._server_messages); + frappe.hide_msgprint(); + frappe.msgprint(r._server_messages); + } - // show errors - if(r.exc) { - r.exc = JSON.parse(r.exc); - if(r.exc instanceof Array) { - $.each(r.exc, function(i, v) { - if(v) { - console.log(v); - } - }) - } else { - console.log(r.exc); + // show errors + if(r.exc) { + r.exc = JSON.parse(r.exc); + if(r.exc instanceof Array) { + $.each(r.exc, function(i, v) { + if(v) { + console.log(v); + } + }) + } else { + console.log(r.exc); + } } - } - // debug messages - if(r._debug_messages) { - if(opts.args) { - console.log("======== arguments ========"); - console.log(opts.args); - console.log("========") + // debug messages + if(r._debug_messages) { + if(opts.args) { + console.log("======== arguments ========"); + console.log(opts.args); + console.log("========") + } + $.each(JSON.parse(r._debug_messages), function(i, v) { console.log(v); }); + console.log("======== response ========"); + delete r._debug_messages; + console.log(r); + console.log("========"); } - $.each(JSON.parse(r._debug_messages), function(i, v) { console.log(v); }); - console.log("======== response ========"); - delete r._debug_messages; - console.log(r); - console.log("========"); } - frappe.last_response = r; frappe.request.ajax_count--; From 497103de25a1a685c40accefc1565d4d742e3083 Mon Sep 17 00:00:00 2001 From: mbauskar Date: Thu, 20 Jul 2017 14:46:01 +0600 Subject: [PATCH 6/6] bumped to version 8.5.6 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index eacda12be8..8fcb74d650 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__ = '8.5.5' +__version__ = '8.5.6' __title__ = "Frappe Framework" local = Local()