minimum width for fieldtype currency is 100px

This commit is contained in:
Nabin Hait 2013-01-25 14:11:50 +05:30
parent fe8ae73f9d
commit ebd7289723
2 changed files with 7 additions and 3 deletions

View file

@ -206,6 +206,10 @@ def validate_fields(fields):
if d.hidden and d.reqd:
webnotes.msgprint("""#%(idx)s %(label)s: Cannot be hidden and mandatory (reqd)""" % d.fields,
raise_exception=True)
def check_width(d):
if d.fieldtype == "Currency" and cint(d.width) < 100:
webnotes.msgprint("Minimum width for FieldType 'Currency' is 100px", raise_exception=1)
for d in fields:
if not d.permlevel: d.permlevel = 0

View file

@ -98,9 +98,9 @@ _f.Grid.prototype.insert_column = function(doctype, fieldname, fieldtype, label,
var idx = this.head_row.cells.length;
if(!width)width = '100px';
if((width+'').slice(-2)!='px') {
width= width + 'px';
}
if(fieldtype=="Currency" && cint(width) < 100) width = "100px";
width= cint(width) + 'px';
var col = this.head_row.insertCell(idx);
col.doctype = doctype; // for report (fields may be from diff doctypes)