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)