Make "view row" prettier for receiving batch, for buefy themes

this seems like a good direction; should make "receive product" and
"declare item" use b-modal on same page probably
This commit is contained in:
Lance Edgar 2021-12-08 21:59:41 -06:00
parent be92075abb
commit e906c01e64
4 changed files with 212 additions and 14 deletions

View file

@ -163,18 +163,25 @@ class ReceivingBatchView(PurchasingBatchView):
'description',
'size',
'case_quantity',
'ordered',
'cases_ordered',
'units_ordered',
'shipped',
'cases_shipped',
'units_shipped',
'received',
'cases_received',
'units_received',
'damaged',
'cases_damaged',
'units_damaged',
'expired',
'cases_expired',
'units_expired',
'mispick',
'cases_mispick',
'units_mispick',
'catalog_unit_cost',
'po_line_number',
'po_unit_cost',
'po_total',
@ -607,6 +614,19 @@ class ReceivingBatchView(PurchasingBatchView):
raise NotImplementedError
return kwargs
def template_kwargs_view_row(self, **kwargs):
kwargs = super(ReceivingBatchView, self).template_kwargs_view_row(**kwargs)
app = self.get_rattail_app()
handler = app.get_products_handler()
row = kwargs['instance']
if row.product:
kwargs['image_url'] = handler.get_image_url(row.product)
elif row.upc:
kwargs['image_url'] = handler.get_image_url(upc=row.upc)
return kwargs
def department_for_purchase(self, purchase):
pass
@ -816,6 +836,8 @@ class ReceivingBatchView(PurchasingBatchView):
return css_class
def get_row_instance_title(self, row):
if row.product:
return six.text_type(row.product)
if row.upc:
return row.upc.pretty()
return super(ReceivingBatchView, self).get_row_instance_title(row)