after adjusting stock_qty for expired, set in_stock flag
This commit is contained in:
parent
c14f1f145b
commit
c7c1defe64
@ -21,8 +21,6 @@ def get_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
|
|||||||
if warehouse:
|
if warehouse:
|
||||||
stock_qty = frappe.db.sql("""select GREATEST(actual_qty - reserved_qty, 0) from tabBin where
|
stock_qty = frappe.db.sql("""select GREATEST(actual_qty - reserved_qty, 0) from tabBin where
|
||||||
item_code=%s and warehouse=%s""", (item_code, warehouse))
|
item_code=%s and warehouse=%s""", (item_code, warehouse))
|
||||||
if stock_qty:
|
|
||||||
in_stock = stock_qty[0][0] > 0 and 1 or 0
|
|
||||||
|
|
||||||
if stock_qty[0][0]:
|
if stock_qty[0][0]:
|
||||||
stock_qty = adjust_for_expired_items(item_code, stock_qty, warehouse)
|
stock_qty = adjust_for_expired_items(item_code, stock_qty, warehouse)
|
||||||
@ -30,6 +28,9 @@ def get_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
|
|||||||
if stock_qty[0][0]:
|
if stock_qty[0][0]:
|
||||||
in_stock = stock_qty[0][0] > 0 and 1 or 0
|
in_stock = stock_qty[0][0] > 0 and 1 or 0
|
||||||
|
|
||||||
|
if stock_qty:
|
||||||
|
in_stock = stock_qty[0][0] > 0 and 1 or 0
|
||||||
|
|
||||||
return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty, "is_stock_item": is_stock_item})
|
return frappe._dict({"in_stock": in_stock, "stock_qty": stock_qty, "is_stock_item": is_stock_item})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user