Virtual Doctype

Hey all, I’m working with virtual doctype and i want to fetch and list the documents from a remote database (MySQL). I got the connection and listed the documents in the list view.
i need to get the details of the document when it get clicked. (same as ordinary doctype).
here I’m getting AttributeError.

can anyone help me with resolving this?

Hi @rinorr:

You need to write your custom load_from_db method.

Something like this

def load_from_db(self):
        item = get_items() // call the method used for listview, with your call to remote db
        target_item = next((item for item in items if str(item["name"]) ==, None)
        super(Document, self).__init__(target_item)

Hope this helps.

1 Like

Thank you for your response. it worked

1 Like