chore: rewrite query using frappe.qb
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 83e0f02..87d4c16 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -654,20 +654,23 @@
 		self.db_set("status", status)
 
 	def get_status(self):
-		"""Returns status based on whether it is draft, submitted, scrapped or depreciated"""
+		"""Returns status based on whether it is draft, submitted, sold, scrapped or depreciated"""
 		if self.docstatus == 0:
 			status = "Draft"
 		elif self.docstatus == 1:
 			status = "Submitted"
 
-			is_asset_sold = frappe.db.sql(
-				"""
-				select item.parent
-				from `tabSales Invoice Item` item, `tabSales Invoice` p
-				where item.asset=%s and item.parent = p.name and p.docstatus = 1
-			""",
-				self.name,
-			)
+			item = frappe.qb.DocType("Sales Invoice Item").as_("item")
+			si = frappe.qb.DocType("Sales Invoice").as_("si")
+
+			is_asset_sold = (
+				frappe.qb.from_(item)
+				.select(item.parent)
+				.inner_join(si)
+				.on(item.parent == si.name)
+				.where(item.asset == self.name)
+				.where(si.docstatus == 1)
+			).run()
 
 			if is_asset_sold:
 				status = "Sold"