mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
fix: BOM Stock Report UoM correction (#24339)
This commit is contained in:
@@ -20,6 +20,7 @@ def get_columns():
|
|||||||
_("Item") + ":Link/Item:150",
|
_("Item") + ":Link/Item:150",
|
||||||
_("Description") + "::300",
|
_("Description") + "::300",
|
||||||
_("BOM Qty") + ":Float:160",
|
_("BOM Qty") + ":Float:160",
|
||||||
|
_("BOM UoM") + "::160",
|
||||||
_("Required Qty") + ":Float:120",
|
_("Required Qty") + ":Float:120",
|
||||||
_("In Stock Qty") + ":Float:120",
|
_("In Stock Qty") + ":Float:120",
|
||||||
_("Enough Parts to Build") + ":Float:200",
|
_("Enough Parts to Build") + ":Float:200",
|
||||||
@@ -32,7 +33,7 @@ def get_bom_stock(filters):
|
|||||||
bom = filters.get("bom")
|
bom = filters.get("bom")
|
||||||
|
|
||||||
table = "`tabBOM Item`"
|
table = "`tabBOM Item`"
|
||||||
qty_field = "qty"
|
qty_field = "stock_qty"
|
||||||
|
|
||||||
qty_to_produce = filters.get("qty_to_produce", 1)
|
qty_to_produce = filters.get("qty_to_produce", 1)
|
||||||
if int(qty_to_produce) <= 0:
|
if int(qty_to_produce) <= 0:
|
||||||
@@ -40,7 +41,6 @@ def get_bom_stock(filters):
|
|||||||
|
|
||||||
if filters.get("show_exploded_view"):
|
if filters.get("show_exploded_view"):
|
||||||
table = "`tabBOM Explosion Item`"
|
table = "`tabBOM Explosion Item`"
|
||||||
qty_field = "stock_qty"
|
|
||||||
|
|
||||||
if filters.get("warehouse"):
|
if filters.get("warehouse"):
|
||||||
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
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.item_code,
|
||||||
bom_item.description ,
|
bom_item.description ,
|
||||||
bom_item.{qty_field},
|
bom_item.{qty_field},
|
||||||
|
bom_item.stock_uom,
|
||||||
bom_item.{qty_field} * {qty_to_produce} / bom.quantity,
|
bom_item.{qty_field} * {qty_to_produce} / bom.quantity,
|
||||||
sum(ledger.actual_qty) as actual_qty,
|
sum(ledger.actual_qty) as actual_qty,
|
||||||
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce} / bom.quantity)))
|
sum(FLOOR(ledger.actual_qty / (bom_item.{qty_field} * {qty_to_produce} / bom.quantity)))
|
||||||
|
|||||||
Reference in New Issue
Block a user