Move row delete check logic for receiving to batch handler

This commit is contained in:
Lance Edgar 2023-05-10 18:47:11 -05:00
parent f942716bf9
commit 82656f263d

View file

@ -84,7 +84,6 @@ class ReceivingBatchView(PurchasingBatchView):
rows_editable = False
rows_editable_but_not_directly = True
rows_deletable = True
default_uom_is_case = True
@ -379,24 +378,8 @@ class ReceivingBatchView(PurchasingBatchView):
if not super(ReceivingBatchView, self).row_deletable(row):
return False
batch = row.batch
# can always delete rows from truck dump parent
if batch.is_truck_dump_parent():
return True
# can always delete rows from truck dump child
elif batch.is_truck_dump_child():
return True
else: # okay, normal batch
if batch.order_quantities_known:
return False
else: # allow delete if receiving rom scratch
return True
# cannot delete row by default
return False
# otherwise let handler decide
return self.batch_handler.is_row_deletable(row)
def get_instance_title(self, batch):
title = super(ReceivingBatchView, self).get_instance_title(batch)