ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Is this possible to pull all standard and custom fields


#1

Hi All,

Actually if select any DocType and press the pull button so all standard and custom fields should appear in blow of that buttons (based on selected doctype)


#2

Hi @eliyaskhan18,

you have a new doctype “Document Review Template”, correct? I would suggest that you add a child table which will then host the orginal documents fields with their respective contents. E.g. DocField, Value, Comment. You will then have top write a server-side code to fetch the fields and values. Is this what you are looking for?

Creating the fields as in the original document is not possible as far as I know.


#3

Hi @lasalesi

Thanks for your response Actually i don’t want values just i want standard fields E.g. i selected Sales Order then Sales Order’s all standard fields should appear in New DocType Document Review Template


#4

Hi @eliyaskhan18,

then still, I would do it with a child table, on the server side, but the DocType with that name and fetch the fields into rows…


#5

Hi @lasalesi

How. will you please give me sample of codes


#6

Hi @eliyaskhan18,

something like (.py)

# read the original doctype (form field source_doctype)
dt = frappe.get_doc("DocType", self.source_doctype)
# loop through fields
for field in dt.fields:
    # add to child table (assuming it is called fields)
    row = self.append('fields', {})
    row.label = field.label

Hope this helps.


#7

Hi @lasalesi

doc_details = frappe.get_meta(doctype).get(“fields”)

using with this code i got all fields but i don’t know how to set fields in my doctype


#8

This command does the same as the above code block, but the above code block will also insert each field into the child table (lines 5ff)… Creating the fields according to the source doctype will not work (you cannot make your doctype change into the source doctype on each instance, it is an underlying table…).

Hope this helps.


#9

Hi @lasalesi

Original doctype’s child tables also will add in my doctype


#10

Hi @lasalesi

dt = frappe.get_doc(“DocType”, self.doc_type)
for field in dt.fields:
# add to child table (assuming it is called fields)
print “fields name -----------”,field.label
row = self.append(‘doc_fields’, {})
row.label = field.label

blank rows adding in my doctype


#11

Is the child tabel cell called “label”? The script will read the DocType “DocType” of the selected type, then read the labels of each field into the target row’s label field…


#12

Hi @lasalesi

thanks for reply but that script adding row only label name is not coming means empty row is adding