Fixes in DB Query, Number Appending to Name

This commit is contained in:
Anand Doshi 2014-03-05 18:15:02 +05:30
parent 090461c8a2
commit e34b1f687e
3 changed files with 3 additions and 3 deletions

View file

@ -55,7 +55,7 @@ class DatabaseQuery(object):
if self.with_childnames:
for t in self.tables:
if t != "`tab" + doctype + "`":
if t != "`tab" + self.doctype + "`":
fields.append(t + ".name as '%s:name'" % t[4:-1])
# query dict

View file

@ -307,7 +307,7 @@ class Document:
def append_number_if_name_exists(self):
if frappe.db.exists(self.doctype, self.name):
last = frappe.db.sql("""select name from `tab{}`
where name regexp '{}-[[:digit:]]*'
where name regexp '{}-[[:digit:]]+'
order by name desc limit 1""".format(self.doctype, self.name))
if last:

View file

@ -12,7 +12,7 @@ import frappe.model.utils
from werkzeug.local import LocalProxy
def report_error(status_code):
if status_code!=404:
if status_code!=404 or frappe.conf.logging:
frappe.errprint(frappe.utils.get_traceback())
frappe._response.status_code = status_code
if frappe.request_method == "POST":