[Fix] Bin not deleted on delete of an item (#13539)
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 9ead587..ab99eaf 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -506,7 +506,7 @@
def on_trash(self):
super(Item, self).on_trash()
- frappe.db.sql("""delete from tabBin where item_code=%s""", self.item_code)
+ frappe.db.sql("""delete from tabBin where item_code=%s""", self.name)
frappe.db.sql("delete from `tabItem Price` where item_code=%s", self.name)
for variant_of in frappe.get_all("Item", filters={"variant_of": self.name}):
frappe.delete_doc("Item", variant_of.name)