From 33632bedbb993fca057cb36528f1bfd71d17be1a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 17 Jul 2015 14:43:31 +0530 Subject: [PATCH] [minor] cleanup for random and messages in field group --- frappe/app.py | 1 + frappe/public/js/frappe/ui/field_group.js | 8 +++----- frappe/utils/make_random.py | 6 +++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frappe/app.py b/frappe/app.py index 4a645fa746..d670cb8e56 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -70,6 +70,7 @@ def application(request): except Exception, e: http_status_code = getattr(e, "http_status_code", 500) + #print frappe.get_traceback() if (http_status_code==500 and isinstance(e, MySQLdb.OperationalError) diff --git a/frappe/public/js/frappe/ui/field_group.js b/frappe/public/js/frappe/ui/field_group.js index f7b1198b67..53705fe8e8 100644 --- a/frappe/public/js/frappe/ui/field_group.js +++ b/frappe/public/js/frappe/ui/field_group.js @@ -55,16 +55,14 @@ frappe.ui.FieldGroup = frappe.ui.form.Layout.extend({ var v = f.get_parsed_value(); if(f.df.reqd && !v) - errors.push('- ' + __(f.df.label) + "
"); + errors.push(__(f.df.label)); if(v) ret[f.df.fieldname] = v; } } if(errors.length) { - msgprint($.format('\ - {0}:\ -

\ - {1}', [__('Missing Values Required'), errors.join('\n')])); + msgprint('' + __('Missing Values Required') + "
" + + errors.join('
')); return null; } return ret; diff --git a/frappe/utils/make_random.py b/frappe/utils/make_random.py index 924771c8ac..305a020e14 100644 --- a/frappe/utils/make_random.py +++ b/frappe/utils/make_random.py @@ -3,7 +3,11 @@ import frappe, random from erpnext_demo import settings def add_random_children(doc, fieldname, rows, randomize, unique=None): - for i in xrange(random.randrange(1, rows)): + nrows = rows + if rows > 1: + nrows = random.randrange(1, rows) + + for i in xrange(nrows): d = {} for key, val in randomize.items(): if isinstance(val[0], basestring):