Add toggle complete, more normalized row fields for odering batch API
This commit is contained in:
parent
77eead761e
commit
a79bf3f055
|
@ -45,6 +45,7 @@ class OrderingBatchViews(APIBatchView):
|
|||
permission_prefix = 'ordering'
|
||||
collection_url_prefix = '/ordering-batches'
|
||||
object_url_prefix = '/ordering-batch'
|
||||
supports_toggle_complete = True
|
||||
|
||||
def base_query(self):
|
||||
"""
|
||||
|
@ -106,33 +107,32 @@ class OrderingBatchRowViews(APIBatchRowView):
|
|||
data = super(OrderingBatchRowViews, self).normalize(row)
|
||||
|
||||
data['item_id'] = row.item_id
|
||||
# data['upc'] = six.text_type(row.upc)
|
||||
# data['upc_pretty'] = row.upc.pretty() if row.upc else None
|
||||
# data['brand_name'] = row.brand_name
|
||||
data['upc'] = six.text_type(row.upc)
|
||||
data['upc_pretty'] = row.upc.pretty() if row.upc else None
|
||||
data['brand_name'] = row.brand_name
|
||||
data['description'] = row.description
|
||||
# data['size'] = row.size
|
||||
# data['full_description'] = row.product.full_description if row.product else row.description
|
||||
data['size'] = row.size
|
||||
data['full_description'] = row.product.full_description if row.product else row.description
|
||||
|
||||
# # only provide image url if so configured
|
||||
# if self.rattail_config.getbool('rattail.batch', 'purchase.mobile_images', default=True):
|
||||
# data['image_url'] = pod.get_image_url(self.rattail_config, row.upc) if row.upc else None
|
||||
|
||||
# # unit_uom can vary by product
|
||||
# data['unit_uom'] = 'LB' if row.product and row.product.weighed else 'EA'
|
||||
|
||||
# data['case_quantity'] = row.case_quantity
|
||||
# data['order_quantities_known'] = batch.order_quantities_known
|
||||
# unit_uom can vary by product
|
||||
data['unit_uom'] = 'LB' if row.product and row.product.weighed else 'EA'
|
||||
|
||||
data['case_quantity'] = row.case_quantity
|
||||
data['cases_ordered'] = row.cases_ordered
|
||||
data['units_ordered'] = row.units_ordered
|
||||
|
||||
data['cases_ordered_display'] = pretty_quantity(row.cases_ordered or 0, empty_zero=False)
|
||||
data['units_ordered_display'] = pretty_quantity(row.units_ordered or 0, empty_zero=False)
|
||||
# 'po_unit_cost': row.po_unit_cost,
|
||||
|
||||
data['po_unit_cost'] = row.po_unit_cost
|
||||
data['po_unit_cost_display'] = "${:0.2f}".format(row.po_unit_cost) if row.po_unit_cost is not None else None
|
||||
# 'po_total_calculated': row.po_total_calculated,
|
||||
data['po_total_calculated'] = row.po_total_calculated
|
||||
data['po_total_calculated_display'] = "${:0.2f}".format(row.po_total_calculated) if row.po_total_calculated is not None else None
|
||||
# 'status_code': row.status_code,
|
||||
# 'status_display': row.STATUS.get(row.status_code, six.text_type(row.status_code)),
|
||||
data['status_code'] = row.status_code
|
||||
data['status_display'] = row.STATUS.get(row.status_code, six.text_type(row.status_code))
|
||||
|
||||
return data
|
||||
|
||||
|
|
Loading…
Reference in a new issue