Merge branch 'master' into develop
This commit is contained in:
commit
958d8ea6c0
10 changed files with 72 additions and 59 deletions
|
|
@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
|
|||
from .exceptions import *
|
||||
from .utils.jinja import get_jenv, get_template, render_template
|
||||
|
||||
__version__ = '7.1.23'
|
||||
__version__ = '7.1.24'
|
||||
__title__ = "Frappe Framework"
|
||||
|
||||
local = Local()
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ def get_data():
|
|||
"name": "Newsletter",
|
||||
"description": _("Newsletters to contacts, leads."),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Email Group",
|
||||
"description": _("Email Group List"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "ToDo",
|
||||
|
|
|
|||
|
|
@ -144,11 +144,6 @@ def get_data():
|
|||
"name": "Standard Reply",
|
||||
"description": _("Standard replies to common queries.")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Email Group",
|
||||
"description": _("Email Group List"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Auto Email Report",
|
||||
|
|
|
|||
|
|
@ -39,9 +39,10 @@ class Report(Document):
|
|||
self.export_doc()
|
||||
|
||||
def update_report_json(self):
|
||||
data = json.loads(self.json)
|
||||
data["add_total_row"] = self.add_total_row
|
||||
self.json = json.dumps(data)
|
||||
if self.json:
|
||||
data = json.loads(self.json)
|
||||
data["add_total_row"] = self.add_total_row
|
||||
self.json = json.dumps(data)
|
||||
|
||||
def export_doc(self):
|
||||
if frappe.flags.in_import:
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ def get_config(app, module):
|
|||
|
||||
for section in config:
|
||||
for item in section["items"]:
|
||||
if item["type"]=="report" and frappe.db.get_value("Report", item["name"], "disabled")==1:
|
||||
section["items"].remove(item)
|
||||
continue
|
||||
if not "label" in item:
|
||||
item["label"] = _(item["name"])
|
||||
return config
|
||||
|
|
|
|||
|
|
@ -2,43 +2,47 @@ frappe.ui.form.on("Print Format", "onload", function(frm) {
|
|||
frm.add_fetch("doc_type", "module", "module");
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Print Format", "refresh", function(frm) {
|
||||
frm.set_intro("");
|
||||
frm.toggle_enable(["html", "doc_type", "module"], false);
|
||||
if (user==="Administrator" || frm.doc.standard==="No") {
|
||||
frm.toggle_enable(["html", "doc_type", "module"], true);
|
||||
frm.enable_save();
|
||||
}
|
||||
|
||||
if(frm.doc.standard==="Yes" && user !== "Administrator") {
|
||||
frm.set_intro(__("Please duplicate this to make changes"));
|
||||
}
|
||||
|
||||
if(!frm.is_new()) {
|
||||
frm.add_custom_button(__("Edit Format"), function() {
|
||||
if(!frm.doc.doc_type) {
|
||||
msgprint(__("Please select DocType first"));
|
||||
return;
|
||||
}
|
||||
frappe.set_route("print-format-builder", frm.doc.name);
|
||||
});
|
||||
|
||||
frm.add_custom_button(__("Make Default"), function() {
|
||||
frappe.call({
|
||||
method: "frappe.print.doctype.print_format.print_format.make_default",
|
||||
args: {
|
||||
name: frm.doc.name
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Print Format", {
|
||||
'custom_format': function(frm) {
|
||||
refresh: function(frm) {
|
||||
frm.set_intro("");
|
||||
frm.toggle_enable(["html", "doc_type", "module"], false);
|
||||
if (user==="Administrator" || frm.doc.standard==="No") {
|
||||
frm.toggle_enable(["html", "doc_type", "module"], true);
|
||||
frm.enable_save();
|
||||
}
|
||||
|
||||
if(frm.doc.standard==="Yes" && user !== "Administrator") {
|
||||
frm.set_intro(__("Please duplicate this to make changes"));
|
||||
}
|
||||
frm.trigger('render_buttons');
|
||||
},
|
||||
render_buttons: function(frm) {
|
||||
frm.page.clear_inner_toolbar();
|
||||
if(!frm.is_new()) {
|
||||
if(!frm.doc.custom_format) {
|
||||
frm.add_custom_button(__("Edit Format"), function() {
|
||||
if(!frm.doc.doc_type) {
|
||||
msgprint(__("Please select DocType first"));
|
||||
return;
|
||||
}
|
||||
frappe.set_route("print-format-builder", frm.doc.name);
|
||||
});
|
||||
}
|
||||
frm.add_custom_button(__("Make Default"), function() {
|
||||
frappe.call({
|
||||
method: "frappe.print.doctype.print_format.print_format.make_default",
|
||||
args: {
|
||||
name: frm.doc.name
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
custom_format: function(frm) {
|
||||
value = frm.doc.custom_format ? 0:1;
|
||||
frm.set_value('align_labels_left', value);
|
||||
frm.set_value('show_section_headings', value);
|
||||
frm.set_value('line_breaks', value);
|
||||
frm.trigger('render_buttons');
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ frappe.views.ListSidebar = Class.extend({
|
|||
|
||||
var add_reports = function(reports) {
|
||||
$.each(reports, function(name, r) {
|
||||
if(!r.ref_doctype || r.ref_doctype==me.doctype && !r.disabled) {
|
||||
if(!r.ref_doctype || r.ref_doctype==me.doctype) {
|
||||
var report_type = r.report_type==='Report Builder'
|
||||
? 'Report/' + r.ref_doctype : 'query-report';
|
||||
var route = r.route || report_type + '/' + r.name;
|
||||
|
|
|
|||
|
|
@ -292,17 +292,16 @@ frappe.search.verbs = [
|
|||
frappe.search.find(keys(frappe.boot.user.all_reports), txt, function(match) {
|
||||
var report = frappe.boot.user.all_reports[match];
|
||||
var route = [];
|
||||
if(!report.disabled)
|
||||
if(report.report_type == "Report Builder")
|
||||
route = ["Report", report.ref_doctype, match];
|
||||
else
|
||||
route = ["query-report", match];
|
||||
if(report.report_type == "Report Builder")
|
||||
route = ["Report", report.ref_doctype, match];
|
||||
else
|
||||
route = ["query-report", match];
|
||||
|
||||
return {
|
||||
label: __("Report {0}", [__(match).bold()]),
|
||||
value: __("Report {0}", [__(match)]),
|
||||
route: route
|
||||
}
|
||||
return {
|
||||
label: __("Report {0}", [__(match).bold()]),
|
||||
value: __("Report {0}", [__(match)]),
|
||||
route: route
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@ class UserPermissions:
|
|||
return d
|
||||
|
||||
def get_all_reports(self):
|
||||
reports = frappe.db.sql("""select name, report_type, ref_doctype, disabled from tabReport
|
||||
where ref_doctype in ('{0}')""".format("', '".join(self.can_get_report)), as_dict=1)
|
||||
reports = frappe.db.sql("""select name, report_type, ref_doctype from tabReport
|
||||
where ref_doctype in ('{0}') and disabled = 0""".format("', '".join(self.can_get_report)), as_dict=1)
|
||||
|
||||
return frappe._dict((d.name, d) for d in reports)
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,14 @@ def get_html(doc, name=None, print_format=None, meta=None,
|
|||
doc._line_breaks = print_format.line_breaks
|
||||
doc._align_labels_left = print_format.align_labels_left
|
||||
|
||||
if print_format.format_data:
|
||||
def get_template_from_string():
|
||||
return jenv.from_string(get_print_format(doc.doctype,
|
||||
print_format))
|
||||
|
||||
if print_format.custom_format:
|
||||
template = get_template_from_string()
|
||||
|
||||
elif print_format.format_data:
|
||||
# set format data
|
||||
format_data = json.loads(print_format.format_data)
|
||||
for df in format_data:
|
||||
|
|
@ -113,9 +120,8 @@ def get_html(doc, name=None, print_format=None, meta=None,
|
|||
|
||||
template = "standard"
|
||||
|
||||
elif print_format.standard=="Yes" or print_format.custom_format:
|
||||
template = jenv.from_string(get_print_format(doc.doctype,
|
||||
print_format))
|
||||
elif print_format.standard=="Yes":
|
||||
template = get_template_from_string()
|
||||
|
||||
else:
|
||||
# fallback
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue