Add support for zero quantity for mobile inventory batch rows
This commit is contained in:
parent
c1e2c5551c
commit
076d3d8189
|
@ -53,7 +53,17 @@
|
||||||
% endif
|
% endif
|
||||||
${h.hidden('units')}
|
${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)}
|
||||||
|
|
||||||
<fieldset data-role="controlgroup" data-type="horizontal" class="inventory-actions">
|
<fieldset data-role="controlgroup" data-type="horizontal" class="inventory-actions">
|
||||||
<button type="button" class="ui-btn-inline ui-corner-all save">Save</button>
|
<button type="button" class="ui-btn-inline ui-corner-all save">Save</button>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<fieldset data-role="controlgroup" data-type="horizontal">
|
<fieldset data-role="controlgroup" data-type="horizontal">
|
||||||
<button type="button" class="ui-btn-active keypad-quantity">${h.pretty_quantity(quantity or 1)}</button>
|
<button type="button" class="ui-btn-active keypad-quantity">${h.pretty_quantity(1 if quantity is None else quantity)}</button>
|
||||||
<button type="button" disabled="disabled"> </button>
|
<button type="button" disabled="disabled"> </button>
|
||||||
% if allow_cases:
|
% if allow_cases:
|
||||||
${h.radio('keypad-uom', value='CS', checked=selected_uom == 'CS', label="CS")}
|
${h.radio('keypad-uom', value='CS', checked=selected_uom == 'CS', label="CS")}
|
||||||
|
|
|
@ -588,12 +588,14 @@ class InventoryBatchView(BatchMasterView):
|
||||||
row = self.Session.query(model.InventoryBatchRow).get(update_form.validated['row'])
|
row = self.Session.query(model.InventoryBatchRow).get(update_form.validated['row'])
|
||||||
cases = update_form.validated['cases']
|
cases = update_form.validated['cases']
|
||||||
units = update_form.validated['units']
|
units = update_form.validated['units']
|
||||||
if cases:
|
if cases is not colander.null:
|
||||||
row.cases = cases
|
row.cases = cases
|
||||||
row.units = None
|
row.units = None
|
||||||
elif units:
|
elif units is not colander.null:
|
||||||
row.cases = None
|
row.cases = None
|
||||||
row.units = units
|
row.units = units
|
||||||
|
else:
|
||||||
|
raise NotImplementedError
|
||||||
self.handler.refresh_row(row)
|
self.handler.refresh_row(row)
|
||||||
route_prefix = self.get_route_prefix()
|
route_prefix = self.get_route_prefix()
|
||||||
return self.redirect(self.request.route_url('mobile.{}.view'.format(route_prefix), uuid=batch.uuid))
|
return self.redirect(self.request.route_url('mobile.{}.view'.format(route_prefix), uuid=batch.uuid))
|
||||||
|
|
Loading…
Reference in a new issue