mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-02 06:29:54 +00:00
@@ -45,9 +45,9 @@ frappe.query_reports["BOM Stock Analysis"] = {
|
||||
}
|
||||
|
||||
if (data && data.bold) {
|
||||
if (column.fieldname === "description" || column.fieldname === "item_name") {
|
||||
const qty_to_make = frappe.query_report.get_filter_value("qty_to_make");
|
||||
const producible = parseFloat(value) || 0;
|
||||
if (column.fieldname === "description") {
|
||||
const qty_to_make = Number(frappe.query_report.get_filter_value("qty_to_make")) || 0;
|
||||
const producible = Number(String(data.description ?? "").replace(/,/g, "")) || 0;
|
||||
const colour = qty_to_make && producible < qty_to_make ? "red" : "green";
|
||||
return `<b style="color: ${colour}">${value}</b>`;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ from pypika.terms import ExistsCriterion
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
filters = filters or {}
|
||||
if filters.get("qty_to_make"):
|
||||
columns = get_columns_with_qty_to_make()
|
||||
data = get_data_with_qty_to_make(filters)
|
||||
@@ -35,7 +36,7 @@ def get_data_with_qty_to_make(filters):
|
||||
bom_data = get_bom_data(filters)
|
||||
manufacture_details = get_manufacturer_records()
|
||||
purchase_rates = batch_fetch_purchase_rates(bom_data)
|
||||
qty_to_make = filters.get("qty_to_make")
|
||||
qty_to_make = flt(filters.get("qty_to_make"))
|
||||
|
||||
data = []
|
||||
for row in bom_data:
|
||||
@@ -203,7 +204,7 @@ def get_bom_data(filters):
|
||||
bom_item.item_code,
|
||||
bom_item.description,
|
||||
bom_item.parent.as_("from_bom_no"),
|
||||
bom_item.qty_consumed_per_unit.as_("qty_per_unit"),
|
||||
Sum(bom_item.qty_consumed_per_unit).as_("qty_per_unit"),
|
||||
IfNull(Sum(bin.actual_qty), 0).as_("actual_qty"),
|
||||
)
|
||||
.where((bom_item.parent == filters.get("bom")) & (bom_item.parenttype == "BOM"))
|
||||
|
||||
@@ -21,8 +21,7 @@ class TestManufacturingReports(ERPNextTestSuite):
|
||||
self.REPORT_FILTER_TEST_CASES: list[tuple[ReportName, ReportFilters]] = [
|
||||
("BOM Explorer", {"bom": self.last_bom}),
|
||||
("BOM Operations Time", {}),
|
||||
("BOM Stock Calculated", {"bom": self.last_bom, "qty_to_make": 2}),
|
||||
("BOM Stock Report", {"bom": self.last_bom, "qty_to_produce": 2}),
|
||||
("BOM Stock Analysis", {"bom": self.last_bom, "_optional": ["warehouse"]}),
|
||||
("Cost of Poor Quality Report", {"item": "_Test Item", "serial_no": "00"}),
|
||||
("Downtime Analysis", {}),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user