Hello,
I have create a Virtual DocType My Test
.
In this I want to load data from it from database. Here is the code in the file my_test.py
.
# Copyright (c) 2022, Yogesh and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
from frappe import _
class MyTest(Document):
def db_insert(self):
pass
def load_from_db(self):
data = frappe.db.sql(""" SELECT `tabPurchase Receipt`.name, `tabPurchase Receipt`.supplier_name, `tabPurchase Receipt`.posting_date, `tabPurchase Receipt Item`.item_name, `tabPurchase Receipt Item`.received_qty, `tabPurchase Receipt Item`.rejected_qty, `tabPurchase Receipt Item`.warehouse, `tabPurchase Receipt Item`.purchase_order, `tabPurchase Receipt Item`.batch_no, `tabPurchase Receipt Item`.coil_heat_no, `tabPurchase Receipt Item`.quality_inspection, `tabPurchase Receipt Item`.coil_qty, `tabPurchase Receipt Item`.coil_wt FROM `tabPurchase Receipt`, `tabPurchase Receipt Item` WHERE `tabPurchase Receipt Item`.parent = `tabPurchase Receipt`.name; """, as_dict=1)
d = data.get(self.name)
return super(Document, self).__init__(d)
def db_update(self):
pass
def get_list(self, args):
pass
def get_count(self, args):
pass
def get_stats(self, args):
pass
When I load the page I am getting error message.
AttributeError: 'list' object has no attribute 'get'
What mistake am I making and how to solve it?
TIA
Yogi Yang