Tweak worksheet_update()
of ordering batch view, to leverage handler
specifically this is to make use of handler's `update_row_quantity()` method, when user enters new order quantities via worksheet
This commit is contained in:
parent
c3f4a3d9ea
commit
fc830f60e8
4 changed files with 112 additions and 40 deletions
|
@ -36,10 +36,16 @@
|
|||
if (data.error) {
|
||||
alert(data.error);
|
||||
} else {
|
||||
row.find('input[name^="cases_ordered_"]').val(data.row_cases_ordered);
|
||||
row.find('input[name^="units_ordered_"]').val(data.row_units_ordered);
|
||||
row.find('td.po-total').html(data.row_po_total);
|
||||
$('.po-total .field').html(data.batch_po_total);
|
||||
if (data.row_cases_ordered || data.row_units_ordered) {
|
||||
row.find('input[name^="cases_ordered_"]').val(data.row_cases_ordered);
|
||||
row.find('input[name^="units_ordered_"]').val(data.row_units_ordered);
|
||||
row.find('td.po-total').html(data.row_po_total_calculated);
|
||||
} else {
|
||||
row.find('input[name^="cases_ordered_"]').val('');
|
||||
row.find('input[name^="units_ordered_"]').val('');
|
||||
row.find('td.po-total').html('');
|
||||
}
|
||||
$('.po-total .field').html(data.batch_po_total_calculated);
|
||||
}
|
||||
submitting = false;
|
||||
});
|
||||
|
@ -151,7 +157,8 @@
|
|||
|
||||
<div class="field-wrapper po-total">
|
||||
<label>PO Total</label>
|
||||
<div class="field">$${'{:0,.2f}'.format(batch.po_total or 0)}</div>
|
||||
## TODO: should not fall back to po_total
|
||||
<div class="field">$${'{:0,.2f}'.format(batch.po_total_calculated or batch.po_total or 0)}</div>
|
||||
</div>
|
||||
|
||||
</div><!-- form-wrapper -->
|
||||
|
@ -270,7 +277,8 @@ ${h.end_form()}
|
|||
<td class="current-order">
|
||||
${h.text('units_ordered_{}'.format(cost.uuid), value=int(cost._batchrow.units_ordered or 0) if cost._batchrow else None)}
|
||||
</td>
|
||||
<td class="po-total">${'${:0,.2f}'.format(cost._batchrow.po_total or 0) if cost._batchrow else ''}</td>
|
||||
## TODO: should not fall back to po_total
|
||||
<td class="po-total">${'${:0,.2f}'.format(cost._batchrow.po_total_calculated or cost._batchrow.po_total or 0) if cost._batchrow else ''}</td>
|
||||
${self.extra_td(cost)}
|
||||
</tr>
|
||||
% endfor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue