diff --git a/frappe/__init__.py b/frappe/__init__.py index dc3a02afb9..a1c3ebf34d 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -24,7 +24,7 @@ if sys.version[0] == '2': reload(sys) sys.setdefaultencoding("utf-8") -__version__ = '11.1.7' +__version__ = '11.1.8' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index 2ab680c765..38d292e9b4 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -101,12 +101,13 @@ def get_permitted_and_not_permitted_links(doctype): not_permitted_links = [] meta = frappe.get_meta(doctype) + allowed_doctypes = frappe.permissions.get_doctypes_with_read() for df in meta.get_link_fields(): if df.options not in ("Customer", "Supplier", "Company", "Sales Partner"): continue - if frappe.has_permission(df.options): + if df.options in allowed_doctypes: permitted_links.append(df) else: not_permitted_links.append(df) @@ -145,10 +146,9 @@ def filter_dynamic_link_doctypes(doctype, txt, searchfield, start, page_len, fil _doctypes = tuple([d for d in _doctypes if re.search(txt+".*", _(d[0]), re.IGNORECASE)]) all_doctypes = [d[0] for d in doctypes + _doctypes] - valid_doctypes = [] + allowed_doctypes = frappe.permissions.get_doctypes_with_read() - for doctype in all_doctypes: - if frappe.has_permission(doctype): - valid_doctypes.append([doctype]) + valid_doctypes = sorted(set(all_doctypes).intersection(set(allowed_doctypes))) + valid_doctypes = [[doctype] for doctype in valid_doctypes] - return sorted(valid_doctypes) + return valid_doctypes diff --git a/frappe/custom/doctype/customize_form/customize_form.js b/frappe/custom/doctype/customize_form/customize_form.js index 125db507ea..0a6f6d4d54 100644 --- a/frappe/custom/doctype/customize_form/customize_form.js +++ b/frappe/custom/doctype/customize_form/customize_form.js @@ -119,7 +119,7 @@ frappe.ui.form.on("Customize Form", { frm.set_df_property("sort_field", "options", fields); } - if(frappe.route_options) { + if(frappe.route_options && frappe.route_options.doc_type) { setTimeout(function() { frm.set_value("doc_type", frappe.route_options.doc_type); frappe.route_options = null; diff --git a/frappe/public/js/frappe/form/controls/geolocation.js b/frappe/public/js/frappe/form/controls/geolocation.js index 7ba1b0b822..d68f6254b9 100644 --- a/frappe/public/js/frappe/form/controls/geolocation.js +++ b/frappe/public/js/frappe/form/controls/geolocation.js @@ -16,7 +16,7 @@ frappe.ui.form.ControlGeolocation = frappe.ui.form.ControlCode.extend({ if ($input_wrapper.is(':visible')) { this.make_map(); } else { - $(document).on('quick-entry-dialog-open', () => { + $(document).on('frappe.ui.Dialog:shown', () => { this.make_map(); }); } diff --git a/frappe/public/js/frappe/form/controls/multiselect.js b/frappe/public/js/frappe/form/controls/multiselect.js index fc5cb05010..bc4f09468b 100644 --- a/frappe/public/js/frappe/form/controls/multiselect.js +++ b/frappe/public/js/frappe/form/controls/multiselect.js @@ -35,7 +35,7 @@ frappe.ui.form.ControlMultiSelect = frappe.ui.form.ControlAutocomplete.extend({ get_value() { let data = this._super(); // find value of label from option list and return actual value string - if (this.df.options[0].label) { + if (this.df.options && this.df.options[0].label) { data = data.split(',').map(op => op.trim()); data = data.map(val => { let option = this.df.options.find(op => op.label === val); @@ -48,7 +48,7 @@ frappe.ui.form.ControlMultiSelect = frappe.ui.form.ControlAutocomplete.extend({ set_formatted_input(value) { if (!value) return; // find label of value from option list and set from it as input - if (this.df.options[0].label) { + if (this.df.options && this.df.options[0].label) { value = value.split(',').map(d => d.trim()).map(val => { let option = this.df.options.find(op => op.value === val); return option ? option.label : val; diff --git a/frappe/public/js/frappe/form/controls/signature.js b/frappe/public/js/frappe/form/controls/signature.js index 315a8ccfe8..82dcb8f341 100644 --- a/frappe/public/js/frappe/form/controls/signature.js +++ b/frappe/public/js/frappe/form/controls/signature.js @@ -7,7 +7,14 @@ frappe.ui.form.ControlSignature = frappe.ui.form.ControlData.extend({ // make jSignature field this.body = $('
').appendTo(me.wrapper); - this.make_pad(); + + if (this.body.is(':visible')) { + this.make_pad(); + } else { + $(document).on('frappe.ui.Dialog:shown', () => { + this.make_pad(); + }); + } this.img_wrapper = $(`
diff --git a/frappe/public/js/frappe/form/quick_entry.js b/frappe/public/js/frappe/form/quick_entry.js index a0cd22163e..257b6cd3ea 100644 --- a/frappe/public/js/frappe/form/quick_entry.js +++ b/frappe/public/js/frappe/form/quick_entry.js @@ -116,9 +116,6 @@ frappe.ui.form.QuickEntryForm = Class.extend({ this.dialog.onhide = () => frappe.quick_entry = null; this.dialog.show(); - this.dialog.$wrapper.on('shown.bs.modal', function() { - $(document).trigger('quick-entry-dialog-open'); - }); this.dialog.refresh_dependency(); this.set_defaults(); diff --git a/frappe/public/js/frappe/list/base_list.js b/frappe/public/js/frappe/list/base_list.js index 04286dff20..d92ca100ce 100644 --- a/frappe/public/js/frappe/list/base_list.js +++ b/frappe/public/js/frappe/list/base_list.js @@ -104,7 +104,9 @@ frappe.views.BaseList = class BaseList { } return f; }); - //de-dup + // remove null or undefined values + this.fields = this.fields.filter(Boolean); + //de-duplicate this.fields = this.fields.uniqBy(f => f[0] + f[1]); } diff --git a/frappe/public/js/frappe/ui/dialog.js b/frappe/public/js/frappe/ui/dialog.js index d2cc4c4ede..0a08c5f0ec 100644 --- a/frappe/public/js/frappe/ui/dialog.js +++ b/frappe/public/js/frappe/ui/dialog.js @@ -85,6 +85,7 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { frappe.ui.open_dialogs.push(me); me.focus_on_first_input(); me.on_page_show && me.on_page_show(); + $(document).trigger('frappe.ui.Dialog:shown'); }) .on('scroll', function() { var $input = $('input:focus');