fix: Removed validate_non_stock_items, filter_service_items methods
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index e6e92f3..f0ca9c4 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -41,7 +41,6 @@
self.validate_serialised_or_batched_item()
self.validate_stock_availablility()
self.validate_return_items_qty()
- # self.validate_non_stock_items()
self.set_status()
self.set_account_for_mode_of_payment()
self.validate_pos()
@@ -226,14 +225,6 @@
.format(d.idx, bold_serial_no, bold_return_against)
)
- def validate_non_stock_items(self):
- for d in self.get("items"):
- is_stock_item = frappe.get_cached_value("Item", d.get("item_code"), "is_stock_item")
- if not is_stock_item:
- if not frappe.db.exists('Product Bundle', d.item_code):
- frappe.throw(_("Row #{}: Item {} is a non stock item. You can only include stock items in a POS Invoice.")
- .format(d.idx, frappe.bold(d.item_code)), title=_("Invalid Item"))
-
def validate_mode_of_payment(self):
if len(self.payments) == 0:
frappe.throw(_("At least one mode of payment is required for POS invoice."))
@@ -477,11 +468,12 @@
bin_qty = get_bin_qty(item_code, warehouse)
pos_sales_qty = get_pos_reserved_qty(item_code, warehouse)
return bin_qty - pos_sales_qty
- elif frappe.db.exists('Product Bundle', item_code):
- return get_bundle_availability(item_code, warehouse)
- #To continue the flow considering a service item
- elif frappe.db.get_value('Item', item_code, 'is_stock_item') == 0:
- return 0
+ else:
+ if frappe.db.exists('Product Bundle', item_code):
+ return get_bundle_availability(item_code, warehouse)
+ else:
+ # Is a service item
+ return 0
def get_bundle_availability(bundle_item_code, warehouse):
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 14201c6..b126f8c 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -99,7 +99,6 @@
), {'warehouse': warehouse}, as_dict=1)
if items_data:
- # items_data = filter_service_items(items_data)
items = [d.item_code for d in items_data]
item_prices_data = frappe.get_all("Item Price",
fields = ["item_code", "price_list_rate", "currency"],
@@ -144,14 +143,6 @@
return {}
-def filter_service_items(items):
- for item in items:
- if not item.get('is_stock_item'):
- if not frappe.db.exists('Product Bundle', item['item_code']):
- items.remove(item)
-
- return items
-
def get_conditions(search_term):
condition = "("
condition += """item.name like {search_term}