Add way to prevent "case" entries for inventory adjustment batch

This commit is contained in:
Lance Edgar 2018-05-23 14:48:17 -05:00
parent 57c2a7981f
commit 54bfafdbfe
4 changed files with 80 additions and 30 deletions

View file

@ -3,22 +3,19 @@
<%namespace file="/mobile/keypad.mako" import="keypad" />
## TODO: this is broken for actual page (header) title
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${h.link_to(instance.batch.id_str, url('mobile.batch.inventory.view', uuid=instance.batch_uuid))} &raquo; ${row.upc.pretty()}</%def>
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${h.link_to(batch.id_str, url('mobile.batch.inventory.view', uuid=batch.uuid))} &raquo; ${row.upc.pretty()}</%def>
<%
unit_uom = 'LB' if row.product and row.product.weighed else 'EA'
if row.cases:
if row.cases and allow_cases:
uom = 'CS'
elif row.units:
if row.product and row.product.weighed:
uom = 'LB'
else:
uom = 'EA'
elif row.case_quantity:
uom = unit_uom
elif row.case_quantity and allow_cases:
uom = 'CS'
else:
uom = 'EA'
uom = unit_uom
%>
<div class="ui-grid-a">
@ -46,20 +43,22 @@
${uom}
</p>
% if not row.batch.executed and not row.batch.complete:
% if not batch.executed and not batch.complete:
${h.form(request.current_route_url())}
${h.csrf_token(request)}
${h.hidden('row', value=row.uuid)}
% if allow_cases:
${h.hidden('cases')}
% endif
${h.hidden('units')}
${keypad(unit_uom, uom, quantity=row.cases or row.units or 1)}
${keypad(unit_uom, uom, quantity=(row.cases or row.units or 1) if allow_cases else (row.units or 1), allow_cases=allow_cases)}
<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 delete" disabled="disabled">Delete</button>
${h.link_to("Cancel", url('mobile.batch.inventory.view', uuid=row.batch.uuid), class_='ui-btn ui-btn-inline ui-corner-all')}
${h.link_to("Cancel", url('mobile.batch.inventory.view', uuid=batch.uuid), class_='ui-btn ui-btn-inline ui-corner-all')}
</fieldset>
${h.end_form()}

View file

@ -1,6 +1,6 @@
## -*- coding: utf-8; -*-
<%def name="keypad(unit_uom, selected_uom, quantity=1)">
<%def name="keypad(unit_uom, selected_uom, quantity=1, allow_cases=True)">
<div class="quantity-keypad-thingy" data-changed="false">
<table>
@ -31,7 +31,9 @@
<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" disabled="disabled">&nbsp;</button>
% if allow_cases:
${h.radio('keypad-uom', value='CS', checked=selected_uom == 'CS', label="CS")}
% endif
${h.radio('keypad-uom', value=unit_uom, checked=selected_uom == unit_uom, label=unit_uom)}
</fieldset>