From 82656f263d39f32df93c59587d5000a45f0cc16c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 10 May 2023 18:47:11 -0500 Subject: [PATCH] Move row delete check logic for receiving to batch handler --- tailbone/views/purchasing/receiving.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 511f8164..4632723d 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -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)