Changeset 076d3d8 in tailbone


Ignore:
Timestamp:
06/27/18 13:43:03 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
ee1065b
Parents:
c1e2c55
Message:

Add support for zero quantity for mobile inventory batch rows

Location:
tailbone
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tailbone/templates/mobile/batch/inventory/view_row.mako

    rc1e2c55 r076d3d8  
    5454    ${h.hidden('units')}
    5555
    56     ${keypad(unit_uom, uom, quantity=(row.cases or row.units or 1) if allow_cases else (row.units or 1), allow_cases=allow_cases)}
     56    <%
     57       quantity = 1
     58       if allow_cases:
     59           if row.cases is not None:
     60               quantity = row.cases
     61           elif row.units is not None:
     62               quantity = row.units
     63       elif row.units is not None:
     64           quantity = row.units
     65    %>
     66    ${keypad(unit_uom, uom, quantity=quantity, allow_cases=allow_cases)}
    5767
    5868    <fieldset data-role="controlgroup" data-type="horizontal" class="inventory-actions">
  • tailbone/templates/mobile/keypad.mako

    rc1e2c55 r076d3d8  
    3030
    3131    <fieldset data-role="controlgroup" data-type="horizontal">
    32       <button type="button" class="ui-btn-active keypad-quantity">${h.pretty_quantity(quantity or 1)}</button>
     32      <button type="button" class="ui-btn-active keypad-quantity">${h.pretty_quantity(1 if quantity is None else quantity)}</button>
    3333      <button type="button" disabled="disabled">&nbsp;</button>
    3434      % if allow_cases:
  • tailbone/views/inventory.py

    rc1e2c55 r076d3d8  
    589589                cases = update_form.validated['cases']
    590590                units = update_form.validated['units']
    591                 if cases:
     591                if cases is not colander.null:
    592592                    row.cases = cases
    593593                    row.units = None
    594                 elif units:
     594                elif units is not colander.null:
    595595                    row.cases = None
    596596                    row.units = units
     597                else:
     598                    raise NotImplementedError
    597599                self.handler.refresh_row(row)
    598600                route_prefix = self.get_route_prefix()
Note: See TracChangeset for help on using the changeset viewer.