From 147a8672b4e35e1f1450693c7a3ae8ce4235ee1b Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Sun, 21 Jun 2026 05:28:12 +0530 Subject: [PATCH] fix(controllers): cast overproduced-qty flag to bool in subcontracting Case The max-allowed-qty Case used `... | ValueWrapper(allow_delivery_of_overproduced_qty)` where the flag is an int (0/1). Postgres rejects `OR ` ("argument of OR must be type boolean"). Wrap it in bool() so the literal renders as true/false. MariaDB behaviour is unchanged. Surgical: only the bool() wrap is applied; develop's weighted-average rate logic and the internal/whitelisted status-helper split are left intact (the staging branch predated both). Covered by test_subcontracting_inward_order.test_over_production_delivery, which now passes on Postgres and is unchanged on MariaDB. Co-Authored-By: Claude Opus 4.8 (1M context) --- erpnext/controllers/subcontracting_inward_controller.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/subcontracting_inward_controller.py b/erpnext/controllers/subcontracting_inward_controller.py index fbacdc95a81..4907f2d8484 100644 --- a/erpnext/controllers/subcontracting_inward_controller.py +++ b/erpnext/controllers/subcontracting_inward_controller.py @@ -509,8 +509,9 @@ class SubcontractingInwardController: ( Case() .when( + # bool() so the literal renders as true/false; postgres rejects `OR ` (table.produced_qty < table.qty) - | ValueWrapper(allow_delivery_of_overproduced_qty), + | ValueWrapper(bool(allow_delivery_of_overproduced_qty)), table.produced_qty, ) .else_(table.qty)