Fix bulk-delete for batch rows, allow it for pricing batches
This commit is contained in:
parent
2df51bfef8
commit
2dc539c357
|
@ -740,7 +740,7 @@ class BatchMasterView(MasterView):
|
|||
"Delete" all rows matching the current row grid view query. This sets
|
||||
the ``removed`` flag on the rows but does not truly delete them.
|
||||
"""
|
||||
query = self.get_effective_row_query()
|
||||
query = self.get_effective_row_data(sort=False)
|
||||
query.update({'removed': True}, synchronize_session=False)
|
||||
return self.redirect(self.get_action_url('view', self.get_instance()))
|
||||
|
||||
|
|
|
@ -43,8 +43,9 @@ class PricingBatchView(BatchMasterView):
|
|||
route_prefix = 'batch.pricing'
|
||||
url_prefix = '/batches/pricing'
|
||||
creatable = False
|
||||
rows_editable = True
|
||||
bulk_deletable = True
|
||||
rows_editable = True
|
||||
rows_bulk_deletable = True
|
||||
|
||||
grid_columns = [
|
||||
'id',
|
||||
|
|
|
@ -570,6 +570,19 @@ class MasterView(View):
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_effective_row_data(self, session=None, sort=False, **kwargs):
|
||||
"""
|
||||
Convenience method which returns the "effective" data for the row grid,
|
||||
filtered (and optionally sorted) to match what would show on the UI,
|
||||
but not paged.
|
||||
"""
|
||||
if session is None:
|
||||
session = self.Session()
|
||||
kwargs.setdefault('pageable', False)
|
||||
kwargs.setdefault('sortable', sort)
|
||||
grid = self.make_row_grid(session=session, **kwargs)
|
||||
return grid.make_visible_data()
|
||||
|
||||
@classmethod
|
||||
def get_row_route_prefix(cls):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue