How can I add a new new field type "Tree"

I wand add new field type “Tree”
… in a new doctype named “Customer” I want add the “Territory” as link but it should be displayed as a “Tree” not drop down list and only the leaf should be selectable.

Thanks in advance.

To display the Territory Field in Tree view on Customer DocType in ERPNext, you can create a client script. You can create a custom script for the Customer DocType and add the following code to it:

frappe.ui.form.on('Customer', {
    refresh: function(frm) {
        frm.fields_dict['territory'].tree_options = 'Territory';


Thank you for your response, but after apply it nothing happen… please check this screenshot.