Tweak some purchase batch logic per changes in rattail

This commit is contained in:
Lance Edgar 2018-07-17 20:38:48 -05:00
parent d8b45db331
commit 012a06d8a6
2 changed files with 8 additions and 4 deletions

View file

@ -28,7 +28,7 @@
<table>
<tbody>
% if populated_from_purchase:
% if batch.order_quantities_known:
<tr>
<td>ordered</td>
<td>

View file

@ -166,6 +166,7 @@ class ReceivingBatchView(PurchasingBatchView):
'created_by',
'status_code',
'rowcount',
'order_quantities_known',
'complete',
'executed',
'executed_by',
@ -343,6 +344,10 @@ class ReceivingBatchView(PurchasingBatchView):
if self.creating:
f.remove_field('department_uuid')
# order_quantities_known
if not self.editing:
f.remove_field('order_quantities_known')
def template_kwargs_create(self, **kwargs):
kwargs = super(ReceivingBatchView, self).template_kwargs_create(**kwargs)
if self.allow_truck_dump:
@ -510,7 +515,7 @@ class ReceivingBatchView(PurchasingBatchView):
filters = grids.filters.GridFilterSet()
# visible filter options will depend on whether batch came from purchase
if self.handler.populated_from_purchase(batch):
if batch.order_quantities_known:
value_choices = ['incomplete', 'unexpected', 'damaged', 'expired', 'all']
default_status = 'incomplete'
else:
@ -782,7 +787,6 @@ class ReceivingBatchView(PurchasingBatchView):
'parent_model_title': self.get_model_title(),
'product_image_url': pod.get_image_url(self.rattail_config, row.upc),
'form': form,
'populated_from_purchase': self.handler.populated_from_purchase(batch),
'allow_expired': self.handler.allow_expired_credits(),
'allow_cases': self.handler.allow_cases(),
}
@ -849,7 +853,7 @@ class ReceivingBatchView(PurchasingBatchView):
if context['uom'] == 'CS' and row.units_ordered and not row.cases_ordered:
context['uom'] = context['unit_uom']
if self.handler.populated_from_purchase(batch) and not row.cases_ordered and not row.units_ordered:
if batch.order_quantities_known and not row.cases_ordered and not row.units_ordered:
self.request.session.flash("This item was NOT on the original purchase order.", 'receiving-warning')
return self.render_to_response('view_row', context, mobile=True)