I am little confused as to how to use Address in a user created DocType.
I was referring to the documentation , where it says under section How to create an Address, in point number 5 ( Enter Link DocType and Link Name to link this address to customer, supplier etc.), I could not find the names of DocTypes created by me. It shows only selective DocTypes like Bank, Bank Account, Company, Customer, Lead… Shareholder, Supplier, Warehouse etc.
Refer Snapshot below:
It shows also a filter applied to the drop down list.
I have created a doctype called “Site”, and the site can have 0 or more addresses, How can I connect addresses to the Site document type for One Site and Many Addreses (One to Many) relationship.
You cannot use the address form type for a LIST table. I believe what is being referred to in the docs you reference is a LINK type field not a table.
I had the same issue. Wanted the user to click add and add as many addresses they wanted to the user, contact whatever but couldn’t do it. You’ll have to create a new Address List doctype, create the form there and use that as the link reference in the table.
You can still use the default ‘Address’ table and not be forced into creating your own table and syncing your table with the frappe table by creating your new Child List doctype as a Virtual doctype. You’ll have to some validation and code in your server.py but that is pretty trivial now. Just get the Address doc assigned to some var like ‘address’, assign your doc field name to the corresponding Address field names and then address.save().
Thanks for the reply. It makes sense what you wrote.
The last line of you reply is close to what I did to achieve it.
In all the doc types which gets shown in that list of filtered doc types in address doc type (as shown in my snapshot in initial post), there is a field name address_html, which is an HTML type. It means that, the data of that field will be shown simply as html content not rendered as any kind of html form control.
What I did was, I added a field “Address HTML” and “Contact HTML”. The filter in Address Links table, is using the field “Address HTML” or say the html name attribute value “address_html” to search and show the doc types that would be shown in the “Link Document Type” drop downs.
When I did that, I am able to see the “Site” doc type that I created in the “Link Document Type” drop downs of Address Doc Type. Now I think, I would be able to attach as many “Sites” to as many “Addresses”.
I believe, same concept applies to attaching “Contact” to any custom made doc types. Not tested yet, but I think, it might be true for Contacts also.
I just started frappe / py a week ago, so deeply immersed with a lot of questions, confusion and reinstalls. I haven’t even looked at the HTML field type yet, had no idea until now what they could do. Thx.