From 2d3a1f5fab54119d641a1b80f478a43ae3c8c549 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 Jul 2026 14:00:02 +0530 Subject: [PATCH] fix: expose hour rate column in Cost of Poor Quality report + robust float assert --- .../cost_of_poor_quality_report.py | 6 ++++++ .../test_cost_of_poor_quality_report.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py index a86df319441..f95e7bcab5e 100644 --- a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py +++ b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py @@ -120,6 +120,12 @@ def get_columns(filters): "options": "Workstation", "width": "100", }, + { + "label": _("Hour Rate"), + "fieldtype": "Currency", + "fieldname": "hour_rate", + "width": "120", + }, { "label": _("Operating Cost"), "fieldtype": "Currency", diff --git a/erpnext/manufacturing/report/cost_of_poor_quality_report/test_cost_of_poor_quality_report.py b/erpnext/manufacturing/report/cost_of_poor_quality_report/test_cost_of_poor_quality_report.py index 76813b3d2b7..191a57b01ed 100644 --- a/erpnext/manufacturing/report/cost_of_poor_quality_report/test_cost_of_poor_quality_report.py +++ b/erpnext/manufacturing/report/cost_of_poor_quality_report/test_cost_of_poor_quality_report.py @@ -67,8 +67,8 @@ class TestCostOfPoorQualityReport(ERPNextTestSuite): self.assertEqual(row["item_code"], corrective_jc.production_item) self.assertEqual(row["hour_rate"], 100) self.assertEqual(row["total_time_in_mins"], corrective_jc.total_time_in_mins) - # operating_cost = hour_rate * total_time_in_mins / 60 - self.assertEqual(row["operating_cost"], 100 * corrective_jc.total_time_in_mins / 60.0) + # operating_cost = hour_rate * total_time_in_mins / 60 (SQL float -> compare approximately) + self.assertAlmostEqual(row["operating_cost"], 100 * corrective_jc.total_time_in_mins / 60.0, places=6) def test_non_corrective_job_card_is_excluded(self): corrective_jc, _operation, _workstation = self.create_corrective_job_card()