From 257f5ed16fb66ab96e6ff2df249986f9451f6f90 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 19 Sep 2012 12:41:13 +0530 Subject: [PATCH] msgprint fix, company abbreviation length validation --- js/legacy/utils/msgprint.js | 8 +++++++- py/core/doctype/custom_field/custom_field.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/legacy/utils/msgprint.js b/js/legacy/utils/msgprint.js index 089273755a..a89995d9c0 100644 --- a/js/legacy/utils/msgprint.js +++ b/js/legacy/utils/msgprint.js @@ -27,7 +27,9 @@ function msgprint(msg, title) { if(msg instanceof Array) { $.each(msg, function(i,v) { - if(v)msgprint(v); + if(v) { + msgprint(v); + } }) return; } @@ -55,6 +57,10 @@ function msgprint(msg, title) { msg = replace_newlines(msg); msg_dialog.set_title(title || 'Message') + + // append a
if another msg already exists + if(msg_dialog.msg_area.html()) msg_dialog.msg_area.append("
"); + msg_dialog.msg_area.append(msg); msg_dialog.show(); diff --git a/py/core/doctype/custom_field/custom_field.py b/py/core/doctype/custom_field/custom_field.py index 6b9c79916b..1371f47976 100644 --- a/py/core/doctype/custom_field/custom_field.py +++ b/py/core/doctype/custom_field/custom_field.py @@ -45,7 +45,7 @@ class DocType: exists = any(d for d in doctype_doclist if d.doctype == 'DocField' and (d.fields.get('label') == self.doc.label or d.fields.get('fieldname') == self.doc.fieldname)) - if self.doc.__islocal == 1 and exists: + if self.doc.fields.get('__islocal') and exists: msgprint("%s field already exists in Document : %s" % (self.doc.label, self.doc.dt)) raise Exception