Add speedbump by default when deleting any "row" record

also, allow deleting rows for truck dump child batch
This commit is contained in:
Lance Edgar 2018-09-22 19:27:17 -05:00
parent 4a610ba2e6
commit d7863c2572
4 changed files with 6 additions and 5 deletions

View file

@ -72,7 +72,7 @@ class Grid(object):
joiners={}, filterable=False, filters={}, use_byte_string_filters=False,
sortable=False, sorters={}, default_sortkey=None, default_sortdir='asc',
pageable=False, default_pagesize=20, default_page=1,
checkboxes=False, checked=None, main_actions=[], more_actions=[],
checkboxes=False, checked=None, main_actions=[], more_actions=[], delete_speedbump=False,
**kwargs):
self.key = key
@ -112,6 +112,7 @@ class Grid(object):
self.checked = lambda item: False
self.main_actions = main_actions or []
self.more_actions = more_actions or []
self.delete_speedbump = delete_speedbump
self._whgrid_kwargs = kwargs

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8; -*-
<div class="grid ${grid_class}" ${h.HTML.render_attrs(grid_attrs)}>
<div class="grid ${grid_class}" data-delete-speedbump="${'true' if grid.delete_speedbump else 'false'}" ${h.HTML.render_attrs(grid_attrs)}>
<table>
${grid.make_webhelpers_grid()}
</table>

View file

@ -128,7 +128,7 @@ class MasterView(View):
rows_creatable = False
rows_editable = False
rows_deletable = False
rows_deletable_speedbump = False
rows_deletable_speedbump = True
rows_bulk_deletable = False
rows_default_pagesize = 20
rows_downloadable_csv = False

View file

@ -260,9 +260,9 @@ class ReceivingBatchView(PurchasingBatchView):
if batch.is_truck_dump_parent():
return True
# can never delete rows from truck dump child
# can always delete rows from truck dump child
elif batch.is_truck_dump_child():
return False
return True
else: # okay, normal batch
if batch.order_quantities_known: