Now ,me create a Doctype is AAA
first docfield:
Label: Account Name ,Type :Link ,Name: account_name ,Options: Account
second docfield:
Label: Account Code ,Type :Dynamic Link ,Name: account_code ,Options: account_code
You are doing it wrong, in my opinion. Here you want to fetch the account number based on the account, so you have to make the field type “Data” and then use “fetch from.”
You mean like journal Entry?
Dynamic Link will let you select a doctype record based on the Selected doctype, and if you just want to show Account Doctype record, then use the link field instead of Dynamic Link.
I am developing custom doctypes use Dynamic Link.
I have studied the document, but after following the instructions, I am unable to save it.
I Check frappe/core/doctype/doctype/doctype.py/validate_fields
def check_dynamic_link_options(d):
if d.fieldtype == "Dynamic Link":
doctype_pointer = list(filter(lambda df: df.fieldname == d.options, fields))
if (
not doctype_pointer
or (doctype_pointer[0].fieldtype not in ("Link", "Select"))
or (doctype_pointer[0].fieldtype == "Link" and doctype_pointer[0].options != "DocType")
):
frappe.throw(
_(
"Options 'Dynamic Link' type of field must point to another Link Field with options as 'DocType'"
)
)
The reason you are unable to save is that your dynamic link configurations are incorrect. As I mentioned, if you want to show accounts in the field, use the Link field and apply “fetch from”.
Or
If you explain your case in detail, maybe I or someone else can help you.
I am practicing the use of dynamic link fields, simply designing a Doctype is name AAA,
where one DocField fieldname is account_name link the chart of accounts, and the other Doctype is prepared to use the dynamic link. When the previous field selects the account name, the other field dynamically follows and displays the account number.
Okay correct me if I am wrong.
You want to show Account Number based on Account Name
I am assuming you have already set up the field to show the Account Name, which is a Link field, and you are showing all the accounts in the Account Name field.
You now have an “Account Code” field to display the Account Number; you already set up the fetch from in the “Account Code” field as seen in your previous screenshot.
Now do one thing: just change the Type of “Account Code” field from “Dynamic Link” to “Data.” It will automatically fetch the account number in the “Account Code” field.