Merge branch 'master' into staging
This commit is contained in:
commit
efe88591c2
20 changed files with 1477 additions and 125 deletions
|
|
@ -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.8.3'
|
||||
__version__ = '8.8.4'
|
||||
__title__ = "Frappe Framework"
|
||||
|
||||
local = Local()
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class File(NestedSet):
|
|||
if not self.flags.ignore_permissions and \
|
||||
not frappe.has_permission(self.attached_to_doctype,
|
||||
"write", self.attached_to_name):
|
||||
frappe.throw(frappe._("No permission to write / remove."),
|
||||
frappe.throw(frappe._("Cannot delete file as it belongs to {0} {1} for which you do not have permissions").format(self.attached_to_doctype, self.attached_to_name),
|
||||
frappe.PermissionError)
|
||||
except frappe.DoesNotExistError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -93,7 +93,10 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
|
|||
for i, d in enumerate(doctype_row[1:]):
|
||||
if d not in ("~", "-"):
|
||||
if d and doctype_row[i] in (None, '' ,'~', '-', 'DocType:'):
|
||||
dt, parentfield = d, doctype_row[i+2] or None
|
||||
dt, parentfield = d, None
|
||||
# xls format truncates the row, so it may not have more columns
|
||||
if len(doctype_row) > i+2:
|
||||
parentfield = doctype_row[i+2]
|
||||
doctypes.append((dt, parentfield))
|
||||
column_idx_to_fieldname[(dt, parentfield)] = {}
|
||||
column_idx_to_fieldtype[(dt, parentfield)] = {}
|
||||
|
|
@ -210,7 +213,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
|
|||
# file is already attached
|
||||
return
|
||||
|
||||
file = save_url(file_url, None, doctype, docname, "Home/Attachments", 0)
|
||||
save_url(file_url, None, doctype, docname, "Home/Attachments", 0)
|
||||
|
||||
# header
|
||||
if not rows:
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ $.extend(frappe.desktop, {
|
|||
frappe.desktop.wrapper.on("click", ".circle", function() {
|
||||
var doctype = $(this).attr('data-doctype');
|
||||
if(doctype) {
|
||||
frappe.set_route('List', doctype, frappe.ui.notifications.get_filters(doctype));
|
||||
frappe.ui.notifications.show_open_count_list(doctype);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ frappe.pages['modules'].on_page_load = function(wrapper) {
|
|||
page.main.on("click", '.open-notification', function(event) {
|
||||
var doctype = $(this).attr('data-doctype');
|
||||
if(doctype) {
|
||||
frappe.set_route('List', doctype, frappe.ui.notifications.get_filters(doctype));
|
||||
frappe.ui.notifications.show_open_count_list(doctype);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ def uploadfile():
|
|||
ret = method()
|
||||
except Exception:
|
||||
frappe.errprint(frappe.utils.get_traceback())
|
||||
frappe.response['http_status_code'] = 500
|
||||
ret = None
|
||||
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -484,17 +484,16 @@ h6.uppercase,
|
|||
right: 12px;
|
||||
}
|
||||
.signature-reset {
|
||||
z-index: 10;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
padding: 4px 0px;
|
||||
}
|
||||
.signature-img {
|
||||
border: 1px solid #d1d8dd;
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
max-height: 300px;
|
||||
max-height: 150px;
|
||||
}
|
||||
.timeline-new-email {
|
||||
margin: 30px 0px;
|
||||
|
|
|
|||
|
|
@ -2148,10 +2148,8 @@ frappe.ui.form.ControlSignature = frappe.ui.form.ControlData.extend({
|
|||
this._super();
|
||||
|
||||
// make jSignature field
|
||||
this.$pad = $('<div class="signature-field"></div>')
|
||||
.appendTo(me.wrapper)
|
||||
.jSignature({height:300, width: "100%", "lineWidth": 0.8})
|
||||
.on('change', this.on_save_sign.bind(this));
|
||||
this.body = $('<div class="signature-field"></div>').appendTo(me.wrapper);
|
||||
this.make_pad();
|
||||
|
||||
this.img_wrapper = $(`<div class="signature-display">
|
||||
<div class="missing-image attach-missing-image">
|
||||
|
|
@ -2161,18 +2159,31 @@ frappe.ui.form.ControlSignature = frappe.ui.form.ControlData.extend({
|
|||
this.img = $("<img class='img-responsive attach-image-display'>")
|
||||
.appendTo(this.img_wrapper).toggle(false);
|
||||
|
||||
},
|
||||
make_pad: function() {
|
||||
let width = this.body.width();
|
||||
if (width > 0 && !this.$pad) {
|
||||
this.$pad = this.body.jSignature({
|
||||
height: 300,
|
||||
width: this.body.width(),
|
||||
lineWidth: 0.8
|
||||
}).on('change',
|
||||
this.on_save_sign.bind(this));
|
||||
this.load_pad();
|
||||
this.$reset_button_wrapper = $(`<div class="signature-btn-row">
|
||||
<a href="#" type="button" class="signature-reset btn btn-default">
|
||||
<i class="glyphicon glyphicon-repeat"></i></a>`)
|
||||
.appendTo(this.$pad)
|
||||
.on("click", '.signature-reset', () => {
|
||||
this.on_reset_sign();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.$btnWrapper = $(`<div class="signature-btn-row">
|
||||
<a href="#" type="button" class="signature-reset btn btn-default">
|
||||
<i class="glyphicon glyphicon-repeat"></i></a>`)
|
||||
.appendTo(this.$pad)
|
||||
.on("click", '.signature-reset', function() {
|
||||
me.on_reset_sign();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
},
|
||||
refresh_input: function(e) {
|
||||
// prevent to load the second time
|
||||
this.make_pad();
|
||||
this.$wrapper.find(".control-input").toggle(false);
|
||||
this.set_editable(this.get_status()=="Write");
|
||||
this.load_pad();
|
||||
|
|
@ -2215,25 +2226,26 @@ frappe.ui.form.ControlSignature = frappe.ui.form.ControlData.extend({
|
|||
}
|
||||
},
|
||||
set_editable: function(editable) {
|
||||
this.$pad.toggle(editable);
|
||||
this.$pad && this.$pad.toggle(editable);
|
||||
this.img_wrapper.toggle(!editable);
|
||||
this.$btnWrapper.toggle(editable);
|
||||
if (editable) {
|
||||
this.$btnWrapper.addClass('editing');
|
||||
}
|
||||
else {
|
||||
this.$btnWrapper.removeClass('editing');
|
||||
if (this.$reset_button_wrapper) {
|
||||
this.$reset_button_wrapper.toggle(editable);
|
||||
if (editable) {
|
||||
this.$reset_button_wrapper.addClass('editing');
|
||||
}
|
||||
else {
|
||||
this.$reset_button_wrapper.removeClass('editing');
|
||||
}
|
||||
}
|
||||
},
|
||||
set_my_value: function(value) {
|
||||
if (this.saving || this.loading) return;
|
||||
this.saving = true;
|
||||
this.set_value(value);
|
||||
this.value = value;
|
||||
this.saving = false;
|
||||
},
|
||||
get_value: function() {
|
||||
return this.value? this.value: this.get_model_value();
|
||||
return this.value ? this.value: this.get_model_value();
|
||||
},
|
||||
// reset signature canvas
|
||||
on_reset_sign: function() {
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
} else {
|
||||
frappe.route_options = this.get_document_filter(doctype);
|
||||
if(show_open) {
|
||||
$.extend(frappe.route_options, frappe.ui.notifications.get_filters(doctype));
|
||||
frappe.ui.notifications.show_open_count_list(doctype);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ frappe.form.link_formatters = {};
|
|||
|
||||
frappe.form.formatters = {
|
||||
_right: function(value, options) {
|
||||
if(options && options.inline) {
|
||||
if(options && (options.inline || options.only_value)) {
|
||||
return value;
|
||||
} else {
|
||||
return "<div style='text-align: right'>" + value + "</div>";
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
this.frm.script_manager.trigger(this.grid.df.fieldname + "_remove",
|
||||
this.doc.doctype, this.doc.name);
|
||||
this.frm.dirty();
|
||||
}
|
||||
this.grid.refresh();
|
||||
},
|
||||
]).catch((e) => {
|
||||
// aborted
|
||||
console.trace(e); // eslint-disable-line
|
||||
|
|
@ -92,8 +93,9 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
this.grid.df.data.forEach(function(d, i) {
|
||||
d.idx = i+1;
|
||||
});
|
||||
|
||||
this.grid.refresh();
|
||||
}
|
||||
this.grid.refresh();
|
||||
}
|
||||
},
|
||||
insert: function(show, below) {
|
||||
|
|
|
|||
|
|
@ -549,6 +549,13 @@ frappe.ui.form.Section = Class.extend({
|
|||
this.head.toggleClass("collapsed", hide);
|
||||
this.indicator.toggleClass("octicon-chevron-down", hide);
|
||||
this.indicator.toggleClass("octicon-chevron-up", !hide);
|
||||
|
||||
// refresh signature fields
|
||||
this.fields_list.forEach((f) => {
|
||||
if (f.df.fieldtype=='Signature') {
|
||||
f.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
has_missing_mandatory: function() {
|
||||
var missing_mandatory = false;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,11 @@ frappe.request.call = function(opts) {
|
|||
500: function(xhr) {
|
||||
frappe.utils.play_sound("error");
|
||||
frappe.msgprint({message:__("Server Error: Please check your server logs or contact tech support."), title:__('Something went wrong'), indicator: 'red'});
|
||||
opts.error_callback && opts.error_callback();
|
||||
frappe.request.report_error(xhr, opts);
|
||||
try {
|
||||
opts.error_callback && opts.error_callback();
|
||||
} catch (e) {
|
||||
frappe.request.report_error(xhr, opts);
|
||||
}
|
||||
},
|
||||
504: function(xhr) {
|
||||
frappe.msgprint(__("Request Timed Out"))
|
||||
|
|
|
|||
|
|
@ -442,15 +442,14 @@ frappe.ui.Filter = Class.extend({
|
|||
var me = this;
|
||||
|
||||
// add a button for new filter if missing
|
||||
this.$btn_group = $('<div class="btn-group">\
|
||||
<button class="btn btn-default btn-xs toggle-filter"\
|
||||
title="'+__("Edit Filter")+'">\
|
||||
%(label)s %(condition)s "%(value)s"\
|
||||
</button>\
|
||||
<button class="btn btn-default btn-xs remove-filter"\
|
||||
title="'+__("Remove Filter")+'">\
|
||||
<i class="fa fa-remove text-muted"></i>\
|
||||
</button></div>')
|
||||
this.$btn_group = $(`<div class="btn-group">
|
||||
<button class="btn btn-default btn-xs toggle-filter"
|
||||
title="${ __("Edit Filter") }">
|
||||
</button>
|
||||
<button class="btn btn-default btn-xs remove-filter"
|
||||
title="${ __("Remove Filter") }">
|
||||
<i class="fa fa-remove text-muted"></i>
|
||||
</button></div>`)
|
||||
.insertAfter(this.flist.wrapper.find(".set-filters .new-filter"));
|
||||
|
||||
this.set_filter_button_text();
|
||||
|
|
|
|||
|
|
@ -103,7 +103,10 @@ frappe.ui.notifications = {
|
|||
show_open_count_list: function(doctype) {
|
||||
let filters = this.boot_info.conditions[doctype];
|
||||
if(filters && $.isPlainObject(filters)) {
|
||||
frappe.route_options = filters;
|
||||
if (!frappe.route_options) {
|
||||
frappe.route_options = {};
|
||||
}
|
||||
$.extend(frappe.route_options, filters);
|
||||
}
|
||||
let route = frappe.get_route();
|
||||
if(route[0]==="List" && route[1]===doctype) {
|
||||
|
|
|
|||
1463
frappe/public/js/lib/jSignature.min.js
vendored
1463
frappe/public/js/lib/jSignature.min.js
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -615,18 +615,17 @@ h6.uppercase, .h6.uppercase {
|
|||
right: 12px;
|
||||
}
|
||||
.signature-reset {
|
||||
z-index: 10;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
padding: 4px 0px;
|
||||
}
|
||||
|
||||
.signature-img {
|
||||
border: 1px solid @border-color;
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
max-height: 300px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}"
|
|||
class="img-responsive"
|
||||
{%- if df.print_width %} style="width: {{ get_width(df) }};"{% endif %}>
|
||||
{% elif df.fieldtype=="Signature" %}
|
||||
<img src="{{ doc[df.fieldname] }}" class="signature-img img-responsive">
|
||||
<img src="{{ doc[df.fieldname] }}" class="signature-img img-responsive"
|
||||
{%- if df.print_width %} style="width: {{ get_width(df) }};"{% endif %}>
|
||||
{% elif df.fieldtype in ("Attach", "Attach Image") and doc[df.fieldname]
|
||||
and (guess_mimetype(doc[df.fieldname])[0] or "").startswith("image/") %}
|
||||
<img src="{{ doc[df.fieldname] }}" class="img-responsive"
|
||||
|
|
|
|||
|
|
@ -156,3 +156,11 @@ table td div {
|
|||
[document-status] {
|
||||
margin-bottom: 5mm;
|
||||
}
|
||||
|
||||
.signature-img {
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
margin-top: 5px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ def get_context(context):
|
|||
"mixpanel_id": frappe.conf.get("mixpanel_id")
|
||||
})
|
||||
|
||||
return context
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_desk_assets(build_version):
|
||||
"""Get desk assets to be loaded for mobile app"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue