msgprint fix, company abbreviation length validation

This commit is contained in:
Anand Doshi 2012-09-19 12:41:13 +05:30
parent 385a4bca87
commit 257f5ed16f
2 changed files with 8 additions and 2 deletions

View file

@ -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 <hr> if another msg already exists
if(msg_dialog.msg_area.html()) msg_dialog.msg_area.append("<hr>");
msg_dialog.msg_area.append(msg);
msg_dialog.show();

View file

@ -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