Loading a doctype in another doctype

Hi Everyone,
Is it possible to load all the fields in a custom doctype which is not a child table into a doctype for example “Purchase order”

Can u pls explain in detail?

In purchase order doctype i have added a custom field which is of type select in that i have set two values top and bottom ,
When i select Top a doctype named Top should get loaded there (Top is a doctype i have created for customization purpose)

@Abai If u want to set two values “top” and “bottom” in your custom field, use “select” instead of using “check”.

And write client script as “when TOP is selected , get that doctype and send that doctype to the frappe”.

I have tried but it is not working out
Is there any other method or can you help me with the client script code

Yes… I did that in my system. If u want i will send that video and code.

Yeah please share me that

frappe.ui.form.on(‘test1’, {
refresh: function (frm) {
// Add a trigger for the ‘select’ field change
frm.fields_dict[‘select_top_or_bottom’].$input.on(‘change’, function () {
// Get the selected value
var selected_value = frm.doc.select_top_or_bottom;
// Check the selected value and render the appropriate doctype
if (selected_value === ‘BOTTOM’) {
// Open ‘top’ DocType
frappe.set_route(“Form”, “top”, { “test1”: frm.docname });
} else if (selected_value === ‘TOP’) {
// Open ‘bottom’ DocType
frappe.set_route(“Form”, “bottom”, { “test1”: frm.docname });

Replace “test1” with your main doctype name.

Replace “select_top_or_bottom” with your field name.

Replace “BOTTOM” and “TOP” with options of your select field.

Replace “top” and “bottom” with your doctype names which u want to render after click on select filed.

I hope this will help u .

Thank you.

Thanks for your response