Misc. improvements for desktop receiving views

- don't expose "cases" if config says not to
- don't expose "expired" if config says not to
- use `numeric-input` for quantity fields
- add `product_key_field` to global-ish template context
This commit is contained in:
Lance Edgar 2022-07-26 16:30:04 -05:00
parent 92a52133de
commit 17810d9cae
7 changed files with 125 additions and 84 deletions

View file

@ -152,8 +152,7 @@ class ReceivingBatchView(PurchasingBatchView):
row_grid_columns = [
'sequence',
'upc',
# 'item_id',
'_product_key_',
'vendor_code',
'brand_name',
'description',
@ -177,8 +176,7 @@ class ReceivingBatchView(PurchasingBatchView):
row_form_fields = [
'sequence',
'item_entry',
'upc',
'item_id',
'_product_key_',
'vendor_code',
'product',
'brand_name',
@ -769,6 +767,8 @@ class ReceivingBatchView(PurchasingBatchView):
products_handler = app.get_products_handler()
row = kwargs['instance']
kwargs['allow_cases'] = self.batch_handler.allow_cases()
if row.product:
kwargs['image_url'] = products_handler.get_image_url(row.product)
elif row.upc:
@ -776,8 +776,16 @@ class ReceivingBatchView(PurchasingBatchView):
if use_buefy:
kwargs['row_context'] = self.get_context_row(row)
kwargs['possible_receiving_modes'] = POSSIBLE_RECEIVING_MODES
kwargs['possible_credit_types'] = POSSIBLE_CREDIT_TYPES
modes = list(POSSIBLE_RECEIVING_MODES)
types = list(POSSIBLE_CREDIT_TYPES)
if not self.batch_handler.allow_expired_credits():
if 'expired' in modes:
modes.remove('expired')
if 'expired' in types:
types.remove('expired')
kwargs['possible_receiving_modes'] = modes
kwargs['possible_credit_types'] = types
return kwargs