fix: POS only validate QTY if is_stock_item

POS invoice raised " Item not available " validation error even though item is non_stock.
This commit is contained in:
Maharshi Patel 2022-09-27 15:44:38 +05:30
parent c760ca2323
commit e39e088f18

View File

@ -239,14 +239,14 @@ class POSInvoice(SalesInvoice):
frappe.bold(d.warehouse), frappe.bold(d.warehouse),
frappe.bold(d.qty), frappe.bold(d.qty),
) )
if flt(available_stock) <= 0: if is_stock_item and flt(available_stock) <= 0:
frappe.throw( frappe.throw(
_("Row #{}: Item Code: {} is not available under warehouse {}.").format( _("Row #{}: Item Code: {} is not available under warehouse {}.").format(
d.idx, item_code, warehouse d.idx, item_code, warehouse
), ),
title=_("Item Unavailable"), title=_("Item Unavailable"),
) )
elif flt(available_stock) < flt(d.qty): elif is_stock_item and flt(available_stock) < flt(d.qty):
frappe.throw( frappe.throw(
_( _(
"Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}." "Row #{}: Stock quantity not enough for Item Code: {} under warehouse {}. Available quantity {}."