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)}
diff --git a/tailbone/templates/mobile/keypad.mako b/tailbone/templates/mobile/keypad.mako index 8f0f131d..38cb03da 100644 --- a/tailbone/templates/mobile/keypad.mako +++ b/tailbone/templates/mobile/keypad.mako @@ -29,7 +29,7 @@
- + % if allow_cases: ${h.radio('keypad-uom', value='CS', checked=selected_uom == 'CS', label="CS")} diff --git a/tailbone/views/inventory.py b/tailbone/views/inventory.py index 6c0a16c2..57dcae36 100644 --- a/tailbone/views/inventory.py +++ b/tailbone/views/inventory.py @@ -588,12 +588,14 @@ class InventoryBatchView(BatchMasterView): row = self.Session.query(model.InventoryBatchRow).get(update_form.validated['row']) cases = update_form.validated['cases'] units = update_form.validated['units'] - if cases: + if cases is not colander.null: row.cases = cases row.units = None - elif units: + elif units is not colander.null: row.cases = None row.units = units + else: + raise NotImplementedError self.handler.refresh_row(row) route_prefix = self.get_route_prefix() return self.redirect(self.request.route_url('mobile.{}.view'.format(route_prefix), uuid=batch.uuid))