Refactor inventory batch desktop lookup, to allow for Type 2 UPC logic
for now though, such logic must be provided by custom app
This commit is contained in:
parent
42982a69ea
commit
e9322628cb
2 changed files with 27 additions and 15 deletions
|
@ -334,26 +334,31 @@ class InventoryBatchView(BatchMasterView):
|
|||
product = api.get_product_by_upc(self.Session(), provided)
|
||||
if not product:
|
||||
product = api.get_product_by_upc(self.Session(), checked)
|
||||
if product and (not product.deleted or self.request.has_perm('products.view_deleted')):
|
||||
data['uuid'] = product.uuid
|
||||
data['upc'] = six.text_type(product.upc)
|
||||
data['upc_pretty'] = product.upc.pretty()
|
||||
data['full_description'] = product.full_description
|
||||
data['brand_name'] = six.text_type(product.brand or '')
|
||||
data['description'] = product.description
|
||||
data['size'] = product.size
|
||||
data['case_quantity'] = 1 # default
|
||||
data['cost_found'] = False
|
||||
data['image_url'] = pod.get_image_url(self.rattail_config, product.upc)
|
||||
data = self.product_info(product)
|
||||
|
||||
result = {'product': data or None, 'upc': None}
|
||||
result = {'product': data or None, 'upc_raw': upc, 'upc': None}
|
||||
if not data and upc:
|
||||
upc = GPC(upc)
|
||||
result['upc'] = unicode(upc)
|
||||
result['upc'] = six.text_type(upc)
|
||||
result['upc_pretty'] = upc.pretty()
|
||||
result['image_url'] = pod.get_image_url(self.rattail_config, upc)
|
||||
return result
|
||||
|
||||
def product_info(self, product):
|
||||
data = {}
|
||||
if product and (not product.deleted or self.request.has_perm('products.view_deleted')):
|
||||
data['uuid'] = product.uuid
|
||||
data['upc'] = six.text_type(product.upc)
|
||||
data['upc_pretty'] = product.upc.pretty()
|
||||
data['full_description'] = product.full_description
|
||||
data['brand_name'] = six.text_type(product.brand or '')
|
||||
data['description'] = product.description
|
||||
data['size'] = product.size
|
||||
data['case_quantity'] = 1 # default
|
||||
data['cost_found'] = False
|
||||
data['image_url'] = pod.get_image_url(self.rattail_config, product.upc)
|
||||
return data
|
||||
|
||||
def configure_mobile_form(self, f):
|
||||
super(InventoryBatchView, self).configure_mobile_form(f)
|
||||
batch = f.model_instance
|
||||
|
@ -608,7 +613,7 @@ class DesktopForm(colander.Schema):
|
|||
|
||||
description = colander.SchemaNode(colander.String())
|
||||
|
||||
size = colander.SchemaNode(colander.String())
|
||||
size = colander.SchemaNode(colander.String(), missing=colander.null)
|
||||
|
||||
case_quantity = colander.SchemaNode(colander.Decimal())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue