Highlight "has inventory" rows for delete item batch

also pass list of such rows to template context
This commit is contained in:
Lance Edgar 2021-04-27 18:31:11 -05:00
parent 60fe7cf29c
commit 661d536e9d

View file

@ -88,10 +88,20 @@ class DeleteProductBatchView(BatchMasterView):
'status_text',
]
def template_kwargs_view(self, **kwargs):
kwargs = super(DeleteProductBatchView, self).template_kwargs_view(**kwargs)
batch = kwargs['batch']
kwargs['rows_with_inventory'] = [row for row in batch.active_rows()
if row.status_code == row.STATUS_HAS_INVENTORY]
return kwargs
def row_grid_extra_class(self, row, i):
if row.status_code == row.STATUS_PRODUCT_NOT_FOUND:
return 'warning'
if row.status_code in (row.STATUS_DELETE_NOT_ALLOWED,
row.STATUS_HAS_INVENTORY,
row.STATUS_PENDING_CUSTOMER_ORDERS):
return 'notice'