Merge branch 'hotfix'

This commit is contained in:
Ameya Shenoy 2018-05-22 08:43:16 +00:00
commit 67fcbaa06b
No known key found for this signature in database
GPG key ID: AC016A555657D0A3
10 changed files with 44 additions and 53 deletions

View file

@ -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__ = '10.1.31'
__version__ = '10.1.32'
__title__ = "Frappe Framework"
local = Local()

View file

@ -198,7 +198,7 @@ def get_shipping_address(company, address = None):
["Dynamic Link", "link_name", "=", company],
["Address", "is_your_company_address", "=", 1]
]
fields = ["name", "address_line1", "address_line2", "city", "state", "country"]
fields = ["*"]
if address and frappe.db.get_value('Dynamic Link',
{'parent': address, 'link_name': company}):
filters.append(["Address", "name", "=", address])

View file

@ -242,37 +242,6 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "notify_by_email",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Notify by email",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,

View file

@ -180,17 +180,18 @@ frappe.activity.render_heatmap = function(page) {
method: "frappe.desk.page.activity.activity.get_heatmap_data",
callback: function(r) {
if(r.message) {
var heatmap = new Chart({
parent: ".heatmap",
var heatmap = new frappeChart.Chart(".heatmap", {
type: 'heatmap',
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "actions",
discrete_domains: 0,
countLabel: "actions",
discreteDomains: 0,
data: {}
});
heatmap.update(r.message);
heatmap.update({
dataPoints: r.message
});
}
}
})

View file

@ -275,3 +275,21 @@ Example,
"erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily"
],
}
### Jinja Customization
Fetch custom methods and filters that are to be available globally in jinja environment.
* `methods`
* `filters`
Example,
jenv = {
"methods": [
"method_name:dotted.path.to.method_definition"
],
"filters": [
"filter_name:dotted.path.to.filter_function"
]
}

View file

@ -327,20 +327,20 @@ frappe.ui.form.Dashboard = Class.extend({
update_heatmap: function(data) {
if(this.heatmap) {
this.heatmap.update(data);
this.heatmap.update({
dataPoints: data
});
}
},
// heatmap
render_heatmap: function() {
if(!this.heatmap) {
this.heatmap = new Chart({
parent: "#heatmap-" + frappe.model.scrub(this.frm.doctype),
this.heatmap = new frappeChart.Chart("#heatmap-" + frappe.model.scrub(this.frm.doctype), {
type: 'heatmap',
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "interactions",
discrete_domains: 0,
countLabel: "interactions",
discreteDomains: 0,
data: {}
});
@ -407,14 +407,12 @@ frappe.ui.form.Dashboard = Class.extend({
var me = this;
this.chart_area.empty().removeClass('hidden');
$.extend(args, {
parent: '.form-graph',
type: 'line',
height: 140,
colors: ['green']
});
this.show();
this.chart = new Chart(args);
this.chart = new frappeChart.Chart('.form-graph', args);
if(!this.chart) {
this.hide();
}

View file

@ -674,8 +674,7 @@ frappe.views.GridReportWithPlot = frappe.views.GridReport.extend({
}
var chart_data = this.get_chart_data ? this.get_chart_data() : null;
this.chart = new Chart({
parent: ".chart",
this.chart = new frappeChart.Chart(".chart", {
height: 200,
data: chart_data,
type: 'line'

View file

@ -949,13 +949,12 @@ frappe.views.QueryReport = Class.extend({
}
$.extend(opts, {
parent: ".chart-area",
height: 200
});
if(opts.data && opts.data.labels && opts.data.labels.length) {
this.chart_area.toggle(true);
this.chart = new Chart(opts);
this.chart = new frappeChart.Chart(".chart-area", opts);
}
},

File diff suppressed because one or more lines are too long

View file

@ -156,6 +156,12 @@ def get_allowed_functions_for_jenv():
"escape": frappe.db.escape,
}
# load jenv methods from hooks.py
for app in frappe.get_installed_apps():
for jenv_method in frappe.get_hooks(app_name=app).get('jenv', {"methods": []})["methods"]:
method_name, method_definition = jenv_method.split(":")
out[method_name] = frappe.get_attr(method_definition)
return out
def get_jloader():
@ -205,6 +211,6 @@ def set_filters(jenv):
# load jenv_filters from hooks.py
for app in frappe.get_installed_apps():
for jenv_filter in (frappe.get_hooks(app_name=app).jenv_filter or []):
for jenv_filter in frappe.get_hooks(app_name=app).get('jenv', {"filters": []})["filters"]:
filter_name, filter_function = jenv_filter.split(":")
jenv.filters[filter_name] = frappe.get_attr(filter_function)