From 2a8d0213e767572701534f329d55e79f2b4d63e7 Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Tue, 24 Sep 2019 17:07:54 +0530 Subject: [PATCH 1/4] fix: document.title reset while updating modules --- frappe/public/js/frappe/views/components/Modules.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/views/components/Modules.vue b/frappe/public/js/frappe/views/components/Modules.vue index a746902b53..fd5f11d21f 100644 --- a/frappe/public/js/frappe/views/components/Modules.vue +++ b/frappe/public/js/frappe/views/components/Modules.vue @@ -41,7 +41,7 @@ export default { methods: { update_current_module() { let route = frappe.get_route() - if (route[0] === 'modules' || !route[0]) { + if (route[0] === 'modules') { this.route = route let module = this.modules_list.filter(m => m.module_name == route[1])[0] let module_name = module && (module.label || module.module_name) From c07044d7f2d1c295cdb27223b07c45b7113ae215 Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Wed, 25 Sep 2019 13:53:06 +0530 Subject: [PATCH 2/4] fix: title overlapping on forms with long titles --- frappe/public/js/frappe/ui/page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/ui/page.html b/frappe/public/js/frappe/ui/page.html index a19529b57c..7f5962f248 100644 --- a/frappe/public/js/frappe/ui/page.html +++ b/frappe/public/js/frappe/ui/page.html @@ -6,7 +6,7 @@

-
+
From 4d10138acb3c6c9b14c4df44cf0d190128030b6a Mon Sep 17 00:00:00 2001 From: thefalconx33 Date: Wed, 25 Sep 2019 21:03:33 +0530 Subject: [PATCH 3/4] fix: same link suggestion with different description --- .../public/js/frappe/form/controls/currency.js | 11 +++++++++++ frappe/public/js/frappe/form/controls/link.js | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/frappe/public/js/frappe/form/controls/currency.js b/frappe/public/js/frappe/form/controls/currency.js index 14cae4a33a..141eae1e8e 100644 --- a/frappe/public/js/frappe/form/controls/currency.js +++ b/frappe/public/js/frappe/form/controls/currency.js @@ -1,4 +1,15 @@ frappe.ui.form.ControlCurrency = frappe.ui.form.ControlFloat.extend({ + eval_expression: function(value) { + if (typeof value ==='string' + && value.match(/^[0-9+-/* ]+$/) + // paresFloat('1,44,000') returns 1.0 + // 1,44,000 are being passed when we paste rows from excel sheet to a table + && value.includes(',')) { + return value.replace(",", ""); + } + return value; + }, + format_for_input: function(value) { var formatted_value = format_number(parseFloat(value), this.get_number_format(), this.get_precision()); return isNaN(parseFloat(value)) ? "" : formatted_value; diff --git a/frappe/public/js/frappe/form/controls/link.js b/frappe/public/js/frappe/form/controls/link.js index cc4d3c952a..f206cd12d8 100644 --- a/frappe/public/js/frappe/form/controls/link.js +++ b/frappe/public/js/frappe/form/controls/link.js @@ -171,6 +171,7 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ if(!me.$input.is(":focus")) { return; } + r.results = me.merge_duplicates(r.results); // show filter description in awesomplete if (args.filters) { @@ -276,6 +277,23 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ }); }, + merge_duplicates(results) { + // in case of result like this + // [{value: 'Manufacturer 1', 'description': 'mobile part 1'}, + // {value: 'Manufacturer 1', 'description': 'mobile part 2'}] + // suggestion list has two items with same value (docname) & description + return results.reduce((newArr, currElem) => { + if (newArr.length === 0) return [currElem]; + let element_with_same_value = newArr.find(e => e.value === currElem.value); + if (element_with_same_value) { + element_with_same_value.description += `, ${currElem.description}`; + return [...newArr]; + } + return [...newArr, currElem]; + }, []); + // returns [{value: 'Manufacturer 1', 'description': 'mobile part 1, mobile part 2'}] + }, + get_filter_description(filters) { let doctype = this.get_options(); let filter_array = []; From 3c7125a2eb86ef7c20512929d474cfbc197d91b9 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 2 Oct 2019 09:18:27 +0530 Subject: [PATCH 4/4] style: Fix formatting --- frappe/public/js/frappe/form/controls/currency.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/currency.js b/frappe/public/js/frappe/form/controls/currency.js index 141eae1e8e..1961985117 100644 --- a/frappe/public/js/frappe/form/controls/currency.js +++ b/frappe/public/js/frappe/form/controls/currency.js @@ -1,6 +1,6 @@ frappe.ui.form.ControlCurrency = frappe.ui.form.ControlFloat.extend({ eval_expression: function(value) { - if (typeof value ==='string' + if (typeof value === 'string' && value.match(/^[0-9+-/* ]+$/) // paresFloat('1,44,000') returns 1.0 // 1,44,000 are being passed when we paste rows from excel sheet to a table