Virtual doctype testing errors


We are testing the new virtual doctypes on v13. Right now, we have this versions installed so it’s supossed to be a working feature:
ERPJarl: v13.17.0 (version-13)
Frappe Framework: v13.17.1 (version-13)

  • We created a virtual doctype called “prod_6” with some fields:

  • At first, we were trying to connect the virtual doctype to an external doctype in SQL server but we were getting some errors. So we decided to test with the more simple example fron the documentation: Virtual DocTypes

  • Created a json with this data:



  • Edited the controller with the test:

But we are getting this error trying to load the doctype:

Here is the stack error with some debugging from

As far I can tell, the error seems to be inside row.get in but I dunno why.

Any idea why is this happening? Is it really a working feature?

Thanks in advance.

Really interested on this. I’ve tried many times always unsuccesfully. It could be a fantastic feature. Has anyone achieved this?

We are getting the same problem. Not even the example code is working right now.

Does anyone have any input on this?

Indeed, this is a very interesting feature !

From some research, AFAIK, this seem to be an unfinished feature. May be Frappe guys can tell us. :slight_smile:

So far, I follow this guy tutorial and summarize what I have done as following,

  1. Fixing existing core code,
  •, line 46
def execute(doctype, *args, **kwargs):
	is_virtual = frappe.db.exists("DocType", {"name": doctype, "is_virtual": True})
	if is_virtual:
		return [{"total_count": 0}]
	return DatabaseQuery(doctype).execute(*args, **kwargs)
  •, line 31
	if not frappe.db.exists(doctype, name):
		is_virtual = frappe.db.exists("DocType", {"name": doctype, "is_virtual": True})
		if not is_virtual:
			return []
  1. Create a test Virtual Doctype, I only create super simple virtual doctype, “My Virtual Doctype” with 1 field, “Note” as Text
  2. On the created by the framework, here is the code.
from frappe.model.document import Document

DATA = [
	{"name": "rec1", "note": "Note for 1st record"},
	{"name": "rec2", "note": "Note for 2nd record"},
	{"name": "rec3", "note": "Note for 3rd record"},

class MyVirtualDoctype(Document):

	def load_from_db(self):
		if != self.doctype:
			d = list(filter(lambda l: l["name"] ==, DATA))
			super(Document, self).__init__(d[0])

	def get_list(self, args):
		return DATA

Now, I am able to see the list of DATA and click to open it.



Yep, those modifications to and seems to be working right. Even managed to connect it to another sources that way.

Thanks a lot!

Any chance of doing a PR so this can be fixed in the core ?