'Make parent folders if not exists based on reference doctype and name'

def set_folder_name(self):

    if (self.attached_to_doctype and (not self.folder)):
        self.folder = frappe.db.get_value(u'File', {u'is_attachments_folder': 1})
