From 3b9e9d2c6e4cbdace2067176f18ace3e2908b9f0 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sat, 10 Dec 2022 14:00:29 +0530 Subject: [PATCH] fix: `Enough Parts to Build` in `BOM Stock Report` (cherry picked from commit 723c64ba738b027323487500f09dfd7cafe3468d) --- .../report/bom_stock_report/bom_stock_report.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py index 1e1b4356008e..cdf1541f8881 100644 --- a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py +++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py @@ -4,7 +4,7 @@ import frappe from frappe import _ -from frappe.query_builder.functions import Floor, Sum +from frappe.query_builder.functions import Sum from pypika.terms import ExistsCriterion @@ -58,9 +58,9 @@ def get_bom_stock(filters): bom_item.description, bom_item.stock_qty, bom_item.stock_uom, - bom_item.stock_qty * qty_to_produce / bom.quantity, - Sum(bin.actual_qty).as_("actual_qty"), - Sum(Floor(bin.actual_qty / (bom_item.stock_qty * qty_to_produce / bom.quantity))), + (bom_item.stock_qty / bom.quantity) * qty_to_produce, + Sum(bin.actual_qty), + Sum(bin.actual_qty) / (bom_item.stock_qty / bom.quantity), ) .where((bom_item.parent == filters.get("bom")) & (bom_item.parenttype == "BOM")) .groupby(bom_item.item_code)