diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index cf1734071b..cc154bee3f 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -81,6 +81,7 @@ class DocType: self.set_version() self.make_amendable() self.make_file_list() + self.check_link_replacement_error() def on_update(self): from webnotes.model.db_schema import updatedb @@ -97,6 +98,13 @@ class DocType: webnotes.clear_cache(doctype=self.doc.name) + def check_link_replacement_error(self): + for d in self.doclist.get({"doctype":"DocField", "fieldtype":"Select"}): + if (webnotes.conn.get_value("DocField", d.name, "options") or "").startswith("link:") \ + and not d.options.startswith("link:"): + webnotes.msgprint("link: type Select fields are getting replaced. Please check for %s" % d.label, + raise_exception=True) + def on_trash(self): webnotes.conn.sql("delete from `tabCustom Field` where dt = %s", self.doc.name) webnotes.conn.sql("delete from `tabCustom Script` where dt = %s", self.doc.name) diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py index f18a61a254..84beef6690 100644 --- a/core/page/data_import_tool/data_import_tool.py +++ b/core/page/data_import_tool/data_import_tool.py @@ -267,10 +267,8 @@ def check_record(d, parenttype=None): if docfield.reqd and (val=='' or val==None): raise Exception, "%s is mandatory." % key - if docfield.fieldtype=='Select' and val: - if not docfield.options: - raise Exception, "Select options are missing for %s" - elif docfield.options.startswith('link:'): + if docfield.fieldtype=='Select' and val and docfield.options: + if docfield.options.startswith('link:'): link_doctype = docfield.options.split(':')[1] if not webnotes.conn.exists(link_doctype, val): raise Exception, "%s must be a valid %s" % (key, link_doctype) diff --git a/webnotes/country_info.json b/webnotes/country_info.json index a228ff1163..a9188d9d0d 100644 --- a/webnotes/country_info.json +++ b/webnotes/country_info.json @@ -2244,5 +2244,16 @@ "currency_fraction_units": 100, "currency_symbol": "P", "number_format": "#,###.##" + }, + "Aruba": { + "currency_fraction": "Cent", + "timezones": [ + "America/Aruba" + ], + "currency_name": "Aruban Florin", + "currency": "AWG", + "currency_fraction_units": 100, + "currency_symbol": "Afl", + "number_format": "#,###.##" } } \ No newline at end of file diff --git a/webnotes/sessions.py b/webnotes/sessions.py index c9fa88010c..e23f7b2490 100644 --- a/webnotes/sessions.py +++ b/webnotes/sessions.py @@ -248,8 +248,11 @@ class Session: exp_sec = webnotes.defaults.get_global_default("session_expiry") or "06:00:00" # incase seconds is missing - if len(exp_sec.split(':')) == 2: - exp_sec = exp_sec + ':00' + if exp_sec: + if len(exp_sec.split(':')) == 2: + exp_sec = exp_sec + ':00' + else: + exp_sec = "2:00:00" return exp_sec diff --git a/webnotes/widgets/reportview.py b/webnotes/widgets/reportview.py index 059d68fc71..20fe0ae423 100644 --- a/webnotes/widgets/reportview.py +++ b/webnotes/widgets/reportview.py @@ -63,7 +63,7 @@ def execute(doctype, query=None, filters=None, fields=None, docstatus=None, query = """select %(fields)s from %(tables)s where %(conditions)s %(group_by)s order by %(order_by)s %(limit)s""" % args - return webnotes.conn.sql(query, as_dict=1) + return webnotes.conn.sql(query, as_dict=1, debug=1) def prepare_args(doctype, filters, fields, docstatus, group_by, order_by): global tables @@ -156,7 +156,7 @@ def build_conditions(doctype, fields, filters, docstatus): # make conditions from filters build_filter_conditions(filters, conditions) - + # join parent, child tables for tname in tables[1:]: conditions.append(tname + '.parent = ' + tables[0] + '.name') @@ -179,12 +179,12 @@ def build_filter_conditions(filters, conditions): # prepare in condition if f[2]=='in': - opts = ["'" + t.strip().replace("'", "\'") + "'" for t in f[3].split(',')] + opts = ["'" + t.strip().replace("'", "\\'") + "'" for t in f[3].split(',')] f[3] = "(" + ', '.join(opts) + ")" conditions.append(tname + '.' + f[1] + " " + f[2] + " " + f[3]) else: if isinstance(f[3], basestring): - f[3] = "'" + f[3].replace("'", "\'") + "'" + f[3] = "'" + f[3].replace("'", "\\'") + "'" conditions.append(tname + '.' + f[1] + " " + f[2] + " " + f[3]) else: conditions.append('ifnull(' + tname + '.' + f[1] + ",0) " + f[2] \