Merge branch 'hotfix'

This commit is contained in:
Saurabh 2019-02-20 18:12:47 +05:30
commit c2b87443a0
9 changed files with 23 additions and 16 deletions

View file

@ -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()

View file

@ -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

View file

@ -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;

View file

@ -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();
});
}

View file

@ -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;

View file

@ -7,7 +7,14 @@ frappe.ui.form.ControlSignature = frappe.ui.form.ControlData.extend({
// make jSignature field
this.body = $('<div class="signature-field"></div>').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 = $(`<div class="signature-display">
<div class="missing-image attach-missing-image">

View file

@ -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();

View file

@ -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]);
}

View file

@ -84,6 +84,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');