fix: BOM Stock Report UoM correction (#24339)

This commit is contained in:
Anuja Pawar 2021-01-13 21:04:03 +05:30 committed by GitHub
parent 00ccec7314
commit 0b04e23f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ def get_columns():
_("Item") + ":Link/Item:150",
_("Description") + "::300",
_("BOM Qty") + ":Float:160",
_("BOM UoM") + "::160",
_("Required Qty") + ":Float:120",
_("In Stock Qty") + ":Float:120",
_("Enough Parts to Build") + ":Float:200",
@ -32,7 +33,7 @@ def get_bom_stock(filters):
bom = filters.get("bom")
table = "`tabBOM Item`"
qty_field = "qty"
qty_field = "stock_qty"
qty_to_produce = filters.get("qty_to_produce", 1)
if int(qty_to_produce) <= 0:
@ -40,7 +41,6 @@ def get_bom_stock(filters):
if filters.get("show_exploded_view"):
table = "`tabBOM Explosion Item`"
qty_field = "stock_qty"
if filters.get("warehouse"):
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
@ -59,6 +59,7 @@ def get_bom_stock(filters):
bom_item.item_code,
bom_item.description ,
bom_item.{qty_field},
bom_item.stock_uom,
bom_item.{qty_field} * {qty_to_produce} / bom.quantity,
sum(ledger.actual_qty) as actual_qty,
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce} / bom.quantity)))