From 883598d59a9e17f24e1c407f17ad1fa0b6ecf5f9 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 13 Jun 2022 16:24:48 +0530 Subject: [PATCH] chore: delete BOT RIP --- erpnext/utilities/bot.py | 46 ---------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 erpnext/utilities/bot.py diff --git a/erpnext/utilities/bot.py b/erpnext/utilities/bot.py deleted file mode 100644 index 5c2e576dd2..0000000000 --- a/erpnext/utilities/bot.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt - - -import frappe -from frappe import _ -from frappe.utils.bot import BotParser - - -class FindItemBot(BotParser): - def get_reply(self): - if self.startswith("where is", "find item", "locate"): - if not frappe.has_permission("Warehouse"): - raise frappe.PermissionError - - item = "%{0}%".format(self.strip_words(self.query, "where is", "find item", "locate")) - items = frappe.db.sql( - """select name from `tabItem` where item_code like %(txt)s - or item_name like %(txt)s or description like %(txt)s""", - dict(txt=item), - ) - - if items: - out = [] - warehouses = frappe.get_all("Warehouse") - for item in items: - found = False - for warehouse in warehouses: - qty = frappe.db.get_value( - "Bin", {"item_code": item[0], "warehouse": warehouse.name}, "actual_qty" - ) - if qty: - out.append( - _("{0} units of [{1}](/app/Form/Item/{1}) found in [{2}](/app/Form/Warehouse/{2})").format( - qty, item[0], warehouse.name - ) - ) - found = True - - if not found: - out.append(_("[{0}](/app/Form/Item/{0}) is out of stock").format(item[0])) - - return "\n\n".join(out) - - else: - return _("Did not find any item called {0}").format(item)