diff --git a/tailbone/static/js/tailbone.buefy.numericinput.js b/tailbone/static/js/tailbone.buefy.numericinput.js
index 3fc0d74f..b2f2ac0c 100644
--- a/tailbone/static/js/tailbone.buefy.numericinput.js
+++ b/tailbone/static/js/tailbone.buefy.numericinput.js
@@ -20,7 +20,7 @@ const NumericInput = {
props: {
name: String,
- value: String,
+ value: [Number, String],
placeholder: String,
iconPack: String,
icon: String,
@@ -53,6 +53,10 @@ const NumericInput = {
}
},
+ select() {
+ this.$el.children[0].select()
+ },
+
valueChanged(value) {
this.$emit('input', value)
}
diff --git a/tailbone/templates/receiving/view_row.mako b/tailbone/templates/receiving/view_row.mako
index bee71475..bb4275b8 100644
--- a/tailbone/templates/receiving/view_row.mako
+++ b/tailbone/templates/receiving/view_row.mako
@@ -82,11 +82,11 @@
% if row.product:
- ${form.render_field_readonly('upc')}
+ ${form.render_field_readonly(product_key_field)}
${form.render_field_readonly('product')}
% else:
${form.render_field_readonly('item_entry')}
- ${form.render_field_readonly('upc')}
+ ${form.render_field_readonly(product_key_field)}
${form.render_field_readonly('brand_name')}
${form.render_field_readonly('description')}
${form.render_field_readonly('size')}
@@ -192,15 +192,17 @@
-
-
- {{ rowData.case_quantity }}
-
-
+ % if allow_cases:
+
+
+ {{ rowData.case_quantity }}
+
+
-
-
-
+
+
+
+ % endif
@@ -226,31 +228,39 @@
-
-
+
+
-
-
- Units
-
-
- Cases
-
-
+ % if allow_cases:
+
+
+ Units
+
+
+ Cases
+
+
+ % else:
+
+
+ Units
+
+ % endif
-
- = {{ accountForProductTotalUnits }}
-
+ % if allow_cases:
+
+ = {{ accountForProductTotalUnits }}
+
+ % endif
@@ -325,31 +335,39 @@
-
-
+
+
-
-
- Units
-
-
- Cases
-
-
+ % if allow_cases:
+
+
+ Units
+
+
+ Cases
+
+
+ % else:
+
+
+ Units
+
+ % endif
-
- = {{ declareCreditTotalUnits }}
-
+ % if allow_cases:
+
+ = {{ declareCreditTotalUnits }}
+
+ % endif
@@ -494,7 +512,7 @@
if (this.accountForProductMode == 'expired' && !this.accountForProductExpiration) {
return true
}
- if (!this.accountForProductQuantity) {
+ if (!this.accountForProductQuantity || this.accountForProductQuantity == 0) {
return true
}
if (this.accountForProductSubmitting) {
@@ -506,9 +524,13 @@
ThisPage.methods.accountForProductInit = function() {
this.accountForProductMode = 'received'
this.accountForProductExpiration = null
- this.accountForProductQuantity = null
+ this.accountForProductQuantity = 0
this.accountForProductUOM = 'units'
this.accountForProductShowDialog = true
+ this.$nextTick(() => {
+ this.$refs.accountForProductQuantityInput.select()
+ this.$refs.accountForProductQuantityInput.focus()
+ })
}
ThisPage.methods.accountForProductUOMClicked = function(uom) {
@@ -606,7 +628,7 @@
if (this.declareCreditType == 'expired' && !this.declareCreditExpiration) {
return true
}
- if (!this.declareCreditQuantity) {
+ if (!this.declareCreditQuantity || this.declareCreditQuantity == 0) {
return true
}
if (this.declareCreditSubmitting) {
@@ -618,13 +640,18 @@
ThisPage.methods.declareCreditInit = function() {
this.declareCreditType = null
this.declareCreditExpiration = null
- if (this.rowData.cases_received) {
- this.declareCreditQuantity = this.rowData.cases_received
- this.declareCreditUOM = 'cases'
- } else {
+ % if allow_cases:
+ if (this.rowData.cases_received) {
+ this.declareCreditQuantity = this.rowData.cases_received
+ this.declareCreditUOM = 'cases'
+ } else {
+ this.declareCreditQuantity = this.rowData.units_received
+ this.declareCreditUOM = 'units'
+ }
+ % else:
this.declareCreditQuantity = this.rowData.units_received
this.declareCreditUOM = 'units'
- }
+ % endif
this.declareCreditShowDialog = true
}
@@ -638,11 +665,15 @@
expiration_date: this.declareCreditExpiration,
}
- if (this.declareCreditUOM == 'cases') {
- params.cases = this.declareCreditQuantity
- } else {
+ % if allow_cases:
+ if (this.declareCreditUOM == 'cases') {
+ params.cases = this.declareCreditQuantity
+ } else {
+ params.units = this.declareCreditQuantity
+ }
+ % else:
params.units = this.declareCreditQuantity
- }
+ % endif
this.submitForm(url, params, response => {
this.rowData = response.data.row
diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py
index 6c84f4ab..50a108ef 100644
--- a/tailbone/views/custorders/orders.py
+++ b/tailbone/views/custorders/orders.py
@@ -339,7 +339,6 @@ class CustomerOrderView(MasterView):
'batch': batch,
'normalized_batch': self.normalize_batch(batch),
'new_order_requires_customer': self.batch_handler.new_order_requires_customer(),
- 'product_key_field': self.rattail_config.product_key(),
'product_price_may_be_questionable': self.batch_handler.product_price_may_be_questionable(),
'allow_contact_info_choice': self.batch_handler.allow_contact_info_choice(),
'allow_contact_info_create': self.batch_handler.allow_contact_info_creation(),
diff --git a/tailbone/views/master.py b/tailbone/views/master.py
index b2002f49..b182c839 100644
--- a/tailbone/views/master.py
+++ b/tailbone/views/master.py
@@ -2208,6 +2208,9 @@ class MasterView(View):
'quickie': None,
}
+ key = self.rattail_config.product_key()
+ context['product_key_field'] = self.product_key_fields.get(key, key)
+
if self.expose_quickie_search:
context['quickie'] = self.get_quickie_context()
diff --git a/tailbone/views/products.py b/tailbone/views/products.py
index 6cdb001a..33999781 100644
--- a/tailbone/views/products.py
+++ b/tailbone/views/products.py
@@ -1180,9 +1180,6 @@ class ProductView(MasterView):
product = kwargs['instance']
use_buefy = self.get_use_buefy()
- key = self.rattail_config.product_key()
- kwargs['product_key_field'] = self.product_key_fields.get(key, key)
-
kwargs['image_url'] = self.products_handler.get_image_url(product)
# add price history, if user has access
diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py
index 86ee057a..4209a35d 100644
--- a/tailbone/views/purchasing/batch.py
+++ b/tailbone/views/purchasing/batch.py
@@ -803,7 +803,9 @@ class PurchasingBatchView(BatchMasterView):
app = self.get_rattail_app()
cases = getattr(row, 'cases_{}'.format(field))
units = getattr(row, 'units_{}'.format(field))
- return app.render_cases_units(cases, units)
+ # nb. do not render anything if empty quantities
+ if cases or units:
+ return app.render_cases_units(cases, units)
def make_row_credits_grid(self, row):
use_buefy = self.get_use_buefy()
@@ -815,8 +817,6 @@ class PurchasingBatchView(BatchMasterView):
data=[] if use_buefy else row.credits,
columns=[
'credit_type',
- # 'cases_shorted',
- # 'units_shorted',
'shorted',
'credit_total',
'expiration_date',
@@ -827,20 +827,19 @@ class PurchasingBatchView(BatchMasterView):
],
labels={
'credit_type': "Type",
- 'cases_shorted': "Cases",
- 'units_shorted': "Units",
'shorted': "Quantity",
'credit_total': "Total",
- 'mispick_upc': "Mispick UPC",
- 'mispick_brand_name': "MP Brand",
- 'mispick_description': "MP Description",
- 'mispick_size': "MP Size",
+ # 'mispick_upc': "Mispick UPC",
+ # 'mispick_brand_name': "MP Brand",
+ # 'mispick_description': "MP Description",
+ # 'mispick_size': "MP Size",
})
- g.set_type('cases_shorted', 'quantity')
- g.set_type('units_shorted', 'quantity')
g.set_type('credit_total', 'currency')
+ if not self.batch_handler.allow_expired_credits():
+ g.remove('expiration_date')
+
return g
def render_row_credits(self, row, field):
diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py
index eebb5855..c66c3664 100644
--- a/tailbone/views/purchasing/receiving.py
+++ b/tailbone/views/purchasing/receiving.py
@@ -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