'Sluggify fieldnames if not set from Label.'

def scrub_field_names(self):

    restricted = (u'name', u'parent', u'creation', u'modified', u'modified_by', u'parentfield', u'parenttype', u'file_list', u'flags', u'docstatus')
    for d in self.get(u'fields'):
        if d.fieldtype:
            if (not getattr(d, u'fieldname', None)):
                if d.label:
                    d.fieldname = d.label.strip().lower().replace(u'    ', u'_')
                    if (d.fieldname in restricted):
                        d.fieldname = (d.fieldname + u'1')
                else:
                    d.fieldname = ((d.fieldtype.lower().replace(u'    ', u'_') + u'_') + str(d.idx))
            d.fieldname = d.fieldname.lower()
