Prevent mobile receiving actions for batch which is complete or executed

This commit is contained in:
Lance Edgar 2017-07-11 10:45:05 -05:00
parent af0eea76e2
commit 72b2510681
3 changed files with 88 additions and 74 deletions

View file

@ -6,8 +6,10 @@
${form.render()|n} ${form.render()|n}
<br /> <br />
${h.text('upc-search', class_='receiving-upc-search', placeholder="Enter UPC", autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.receiving.lookup', uuid=batch.uuid)})} % if not instance.executed and not instance.complete:
<br /> ${h.text('upc-search', class_='receiving-upc-search', placeholder="Enter UPC", autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.receiving.lookup', uuid=batch.uuid)})}
<br />
% endif
${grid.render_complete()|n} ${grid.render_complete()|n}

View file

@ -48,80 +48,82 @@
% endfor % endfor
% endif % endif
<table id="receiving-quantity-keypad-thingy" data-changed="false"> % if not instance.batch.executed and not instance.batch.complete:
<tbody> <table id="receiving-quantity-keypad-thingy" data-changed="false">
<tr> <tbody>
<td>${h.link_to("7", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <tr>
<td>${h.link_to("8", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("7", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("9", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("8", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr> <td>${h.link_to("9", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<tr> </tr>
<td>${h.link_to("4", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <tr>
<td>${h.link_to("5", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("4", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("6", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("5", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr> <td>${h.link_to("6", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<tr> </tr>
<td>${h.link_to("1", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <tr>
<td>${h.link_to("2", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("1", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("3", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("2", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr> <td>${h.link_to("3", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<tr> </tr>
<td>${h.link_to("0", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <tr>
<td>${h.link_to(".", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to("0", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("Del", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td> <td>${h.link_to(".", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr> <td>${h.link_to("Del", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tbody> </tr>
</table> </tbody>
</table>
${h.form(request.current_route_url(), class_='receiving-update')} ${h.form(request.current_route_url(), class_='receiving-update')}
${h.csrf_token(request)} ${h.csrf_token(request)}
${h.hidden('row', value=row.uuid)} ${h.hidden('row', value=row.uuid)}
${h.hidden('cases')} ${h.hidden('cases')}
${h.hidden('units')} ${h.hidden('units')}
${h.hidden('expiration_date')} ${h.hidden('expiration_date')}
<% <%
uom = 'CS' uom = 'CS'
if row.units_ordered and not row.cases_ordered: if row.units_ordered and not row.cases_ordered:
uom = 'EA' uom = 'EA'
%> %>
<fieldset data-role="controlgroup" data-type="horizontal"> <fieldset data-role="controlgroup" data-type="horizontal">
<button type="button" class="ui-btn-active receiving-quantity">1</button> <button type="button" class="ui-btn-active receiving-quantity">1</button>
<button type="button" disabled="disabled">&nbsp;</button> <button type="button" disabled="disabled">&nbsp;</button>
${h.radio('receiving-uom', value='CS', checked=uom == 'CS', label="CS")} ${h.radio('receiving-uom', value='CS', checked=uom == 'CS', label="CS")}
${h.radio('receiving-uom', value=unit_uom, checked=uom == unit_uom, label=unit_uom)} ${h.radio('receiving-uom', value=unit_uom, checked=uom == unit_uom, label=unit_uom)}
</fieldset> </fieldset>
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td> <td>
<fieldset data-role="controlgroup" data-type="horizontal"> <fieldset data-role="controlgroup" data-type="horizontal">
${h.radio('mode', value='received', label="received", checked=True)} ${h.radio('mode', value='received', label="received", checked=True)}
${h.radio('mode', value='damaged', label="damaged")} ${h.radio('mode', value='damaged', label="damaged")}
${h.radio('mode', value='expired', label="expired")} ${h.radio('mode', value='expired', label="expired")}
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-actions"> <fieldset data-role="controlgroup" data-type="horizontal" class="receiving-actions">
<button type="button" data-action="add" class="ui-btn-inline ui-corner-all">Add</button> <button type="button" data-action="add" class="ui-btn-inline ui-corner-all">Add</button>
<button type="button" data-action="subtract" class="ui-btn-inline ui-corner-all">Subtract</button> <button type="button" data-action="subtract" class="ui-btn-inline ui-corner-all">Subtract</button>
## <button type="button" data-action="clear" class="ui-btn-inline ui-corner-all ui-state-disabled">Clear</button> ## <button type="button" data-action="clear" class="ui-btn-inline ui-corner-all ui-state-disabled">Clear</button>
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div data-role="popup" id="popup-receiving-expiration" data-dismissible="false" data-overlay-theme="b" class="ui-corner-all"> <div data-role="popup" id="popup-receiving-expiration" data-dismissible="false" data-overlay-theme="b" class="ui-corner-all">
<div style="padding:10px 20px;"> <div style="padding:10px 20px;">
<h3>Please provide expiration date</h3> <h3>Please provide expiration date</h3>
<input name="expiration-date" type="date" value="" placeholder="Expiration Date" /> <input name="expiration-date" type="date" value="" placeholder="Expiration Date" />
<a href="#" class="ui-btn ui-btn-inline ui-corner-all" data-rel="back">Cancel</a> <a href="#" class="ui-btn ui-btn-inline ui-corner-all" data-rel="back">Cancel</a>
<button type="button" class="ui-btn ui-btn-inline ui-corner-all">Submit</button> <button type="button" class="ui-btn ui-btn-inline ui-corner-all">Submit</button>
</div> </div>
</div> </div>
${h.end_form()} ${h.end_form()}
% endif

View file

@ -208,7 +208,17 @@ class ReceivingBatchView(PurchasingBatchView):
fs.configure(include=[ fs.configure(include=[
fs.vendor.with_renderer(fa.TextFieldRenderer), fs.vendor.with_renderer(fa.TextFieldRenderer),
fs.department.with_renderer(fa.TextFieldRenderer), fs.department.with_renderer(fa.TextFieldRenderer),
fs.complete,
fs.executed,
fs.executed_by,
]) ])
batch = fs.model
if not batch.executed:
del [fs.executed, fs.executed_by]
if not batch.complete:
del fs.complete
else:
del fs.complete
def get_mobile_row_data(self, batch): def get_mobile_row_data(self, batch):
return super(ReceivingBatchView, self).get_mobile_row_data(batch)\ return super(ReceivingBatchView, self).get_mobile_row_data(batch)\