fix identation
This commit is contained in:
@@ -13,28 +13,27 @@ def execute(filters=None):
|
|||||||
item_map = get_item_details()
|
item_map = get_item_details()
|
||||||
data = []
|
data = []
|
||||||
for sbom, warehouse in iwq_map.items():
|
for sbom, warehouse in iwq_map.items():
|
||||||
total = 0
|
total = 0
|
||||||
total_qty = 0
|
total_qty = 0
|
||||||
|
|
||||||
|
for wh, item_qty in warehouse.items():
|
||||||
|
total += 1
|
||||||
|
row = [sbom, item_map.get(sbom).item_name, item_map.get(sbom).description,
|
||||||
|
item_map.get(sbom).stock_uom, wh]
|
||||||
|
available_qty = item_qty
|
||||||
|
total_qty += flt(available_qty)
|
||||||
|
row += [available_qty]
|
||||||
|
|
||||||
for wh, item_qty in warehouse.items():
|
if available_qty:
|
||||||
total += 1
|
data.append(row)
|
||||||
row = [sbom, item_map.get(sbom).item_name, item_map.get(sbom).description,
|
if (total == len(warehouse)):
|
||||||
item_map.get(sbom).stock_uom, wh]
|
row = ["", "", "Total", "", "", total_qty]
|
||||||
available_qty = item_qty
|
data.append(row)
|
||||||
total_qty += flt(available_qty)
|
|
||||||
row += [available_qty]
|
|
||||||
|
|
||||||
if available_qty:
|
|
||||||
data.append(row)
|
|
||||||
if (total == len(warehouse)):
|
|
||||||
row = ["", "", "Total", "", "", total_qty]
|
|
||||||
data.append(row)
|
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
columns = ["Item Code:Link/Item:100", "Item Name::100", "Description::120", \
|
columns = ["Item Code:Link/Item:100", "Item Name::100", "Description::120", \
|
||||||
"UOM:Link/UOM:80", "Warehouse:Link/Warehouse:100", "Quantity::100"]
|
"UOM:Link/UOM:80", "Warehouse:Link/Warehouse:100", "Quantity::100"]
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ def get_item_details():
|
|||||||
item_map = {}
|
item_map = {}
|
||||||
for item in frappe.db.sql("""SELECT name, item_name, description, stock_uom
|
for item in frappe.db.sql("""SELECT name, item_name, description, stock_uom
|
||||||
from `tabItem`""", as_dict=1):
|
from `tabItem`""", as_dict=1):
|
||||||
item_map.setdefault(item.name, item)
|
item_map.setdefault(item.name, item)
|
||||||
return item_map
|
return item_map
|
||||||
|
|
||||||
def get_item_warehouse_quantity_map():
|
def get_item_warehouse_quantity_map():
|
||||||
@@ -72,8 +71,8 @@ def get_item_warehouse_quantity_map():
|
|||||||
last_sbom = ""
|
last_sbom = ""
|
||||||
sbom_map = {}
|
sbom_map = {}
|
||||||
for line in result:
|
for line in result:
|
||||||
if line.get("parent") != last_sbom:
|
if line.get("parent") != last_sbom:
|
||||||
last_sbom = line.get("parent")
|
last_sbom = line.get("parent")
|
||||||
actual_dict = sbom_map.setdefault(last_sbom, {})
|
actual_dict = sbom_map.setdefault(last_sbom, {})
|
||||||
actual_dict.setdefault(line.get("warehouse"), line.get("qty"))
|
actual_dict.setdefault(line.get("warehouse"), line.get("qty"))
|
||||||
return sbom_map
|
return sbom_map
|
||||||
Reference in New Issue
Block a user