[minor] cleanup for random and messages in field group
This commit is contained in:
parent
04cf067b75
commit
33632bedbb
3 changed files with 9 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) + "<br>");
|
||||
errors.push(__(f.df.label));
|
||||
|
||||
if(v) ret[f.df.fieldname] = v;
|
||||
}
|
||||
}
|
||||
if(errors.length) {
|
||||
msgprint($.format('<i class="icon-warning-sign"></i>\
|
||||
<b>{0}</b>:\
|
||||
<br/><br/>\
|
||||
{1}', [__('Missing Values Required'), errors.join('\n')]));
|
||||
msgprint('<b>' + __('Missing Values Required') + "</b><br>"
|
||||
+ errors.join('<br>'));
|
||||
return null;
|
||||
}
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue