Merge branch 'hotfix'

This commit is contained in:
mbauskar 2017-08-04 11:02:07 +05:30
commit 52182a27f3
4 changed files with 24 additions and 16 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__ = '8.6.6'
__version__ = '8.6.7'
__title__ = "Frappe Framework"
local = Local()

View file

@ -600,8 +600,9 @@ class Database:
order_by = ("order by " + order_by) if order_by else ""
r = self.sql("select {0} from `tab{1}` where {2} {3}".format(fl, doctype,
conditions, order_by), values, as_dict=as_dict, debug=debug, update=update)
r = self.sql("select {0} from `tab{1}` {2} {3} {4}"
.format(fl, doctype, "where" if conditions else "", conditions, order_by), values,
as_dict=as_dict, debug=debug, update=update)
return r

View file

@ -240,7 +240,12 @@ def get_stats(stats, doctype, filters=[]):
filters = json.loads(filters)
stats = {}
columns = frappe.db.get_table_columns(doctype)
try:
columns = frappe.db.get_table_columns(doctype)
except MySQLdb.OperationalError:
# raised when _user_tags column is added on the fly
columns = []
for tag in tags:
if not tag in columns: continue
try:

View file

@ -8,19 +8,21 @@ import frappe
# For example Journal Entry should be validated before GL Entry (which is an internal doctype)
dynamic_link_queries = [
"""select parent,
(select read_only from `tabDocType` where name=tabDocField.parent) as read_only,
fieldname, options
from tabDocField
where fieldtype='Dynamic Link'
order by read_only""",
"""select tabDocField.parent,
`tabDocType`.read_only, `tabDocType`.in_create,
tabDocField.fieldname, tabDocField.options
from tabDocField, `tabDocType`
where `tabDocField`.fieldtype='Dynamic Link' and
`tabDocType`.name=`tabDocField`.parent
order by `tabDocType`.read_only, `tabDocType`.in_create""",
"""select dt as parent,
(select read_only from `tabDocType` where name=`tabCustom Field`.dt) as read_only,
fieldname, options
from `tabCustom Field`
where fieldtype='Dynamic Link'
order by read_only""",
"""select `tabCustom Field`.dt as parent,
`tabDocType`.read_only, `tabDocType`.in_create,
`tabCustom Field`.fieldname, `tabCustom Field`.options
from `tabCustom Field`, `tabDocType`
where `tabCustom Field`.fieldtype='Dynamic Link' and
`tabDocType`.name=`tabCustom Field`.dt
order by `tabDocType`.read_only, `tabDocType`.in_create""",
]
def get_dynamic_link_map(for_delete=False):