'Create, update custom translation for this doctype'

def set_name_translation(self):

    current = self.get_name_translation()
    if current:
        if (self.label and (current != self.label)):
            frappe.db.set_value(u'Translation', current.name, u'target_name', self.label)
            frappe.translate.clear_cache()
        else:
            frappe.delete_doc(u'Translation', current.name)
    elif self.label:
        frappe.get_doc(dict(doctype=u'Translation', source_name=self.doc_type, target_name=self.label, language_code=(frappe.local.lang or u'en'))).insert()
