diff --git a/tailbone/templates/mobile/batch/inventory/view_row.mako b/tailbone/templates/mobile/batch/inventory/view_row.mako
index d4d49f75..8643da1e 100644
--- a/tailbone/templates/mobile/batch/inventory/view_row.mako
+++ b/tailbone/templates/mobile/batch/inventory/view_row.mako
@@ -53,7 +53,17 @@
% endif
${h.hidden('units')}
- ${keypad(unit_uom, uom, quantity=(row.cases or row.units or 1) if allow_cases else (row.units or 1), allow_cases=allow_cases)}
+ <%
+ quantity = 1
+ if allow_cases:
+ if row.cases is not None:
+ quantity = row.cases
+ elif row.units is not None:
+ quantity = row.units
+ elif row.units is not None:
+ quantity = row.units
+ %>
+ ${keypad(unit_uom, uom, quantity=quantity, allow_cases=allow_cases)}