fix: featching serialized items
This commit is contained in:
parent
073dcf7e42
commit
0358b64743
@ -477,19 +477,19 @@ class StockReconciliation(StockController):
|
|||||||
def get_items(warehouse, posting_date, posting_time, company):
|
def get_items(warehouse, posting_date, posting_time, company):
|
||||||
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
|
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
|
||||||
items = frappe.db.sql("""
|
items = frappe.db.sql("""
|
||||||
select i.name, i.item_name, bin.warehouse
|
select i.name, i.item_name, bin.warehouse, i.has_serial_no
|
||||||
from tabBin bin, tabItem i
|
from tabBin bin, tabItem i
|
||||||
where i.name=bin.item_code and i.disabled=0 and i.is_stock_item = 1
|
where i.name=bin.item_code and i.disabled=0 and i.is_stock_item = 1
|
||||||
and i.has_variants = 0 and i.has_serial_no = 0 and i.has_batch_no = 0
|
and i.has_variants = 0 and i.has_batch_no = 0
|
||||||
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=bin.warehouse)
|
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=bin.warehouse)
|
||||||
""", (lft, rgt))
|
""", (lft, rgt))
|
||||||
|
|
||||||
items += frappe.db.sql("""
|
items += frappe.db.sql("""
|
||||||
select i.name, i.item_name, id.default_warehouse
|
select i.name, i.item_name, id.default_warehouse, i.has_serial_no
|
||||||
from tabItem i, `tabItem Default` id
|
from tabItem i, `tabItem Default` id
|
||||||
where i.name = id.parent
|
where i.name = id.parent
|
||||||
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=id.default_warehouse)
|
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=id.default_warehouse)
|
||||||
and i.is_stock_item = 1 and i.has_serial_no = 0 and i.has_batch_no = 0
|
and i.is_stock_item = 1 and i.has_batch_no = 0
|
||||||
and i.has_variants = 0 and i.disabled = 0 and id.company=%s
|
and i.has_variants = 0 and i.disabled = 0 and id.company=%s
|
||||||
group by i.name
|
group by i.name
|
||||||
""", (lft, rgt, company))
|
""", (lft, rgt, company))
|
||||||
@ -497,7 +497,7 @@ def get_items(warehouse, posting_date, posting_time, company):
|
|||||||
res = []
|
res = []
|
||||||
for d in set(items):
|
for d in set(items):
|
||||||
stock_bal = get_stock_balance(d[0], d[2], posting_date, posting_time,
|
stock_bal = get_stock_balance(d[0], d[2], posting_date, posting_time,
|
||||||
with_valuation_rate=True)
|
with_valuation_rate=True , with_serial_no=cint(d[3]))
|
||||||
|
|
||||||
if frappe.db.get_value("Item", d[0], "disabled") == 0:
|
if frappe.db.get_value("Item", d[0], "disabled") == 0:
|
||||||
res.append({
|
res.append({
|
||||||
@ -507,7 +507,9 @@ def get_items(warehouse, posting_date, posting_time, company):
|
|||||||
"item_name": d[1],
|
"item_name": d[1],
|
||||||
"valuation_rate": stock_bal[1],
|
"valuation_rate": stock_bal[1],
|
||||||
"current_qty": stock_bal[0],
|
"current_qty": stock_bal[0],
|
||||||
"current_valuation_rate": stock_bal[1]
|
"current_valuation_rate": stock_bal[1],
|
||||||
|
"current_serial_no": stock_bal[2] if cint(d[3]) else '',
|
||||||
|
"serial_no": stock_bal[2] if cint(d[3]) else ''
|
||||||
})
|
})
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user