From c4bb12fca5d70ebe02d05f78ffedddf5fe7852c8 Mon Sep 17 00:00:00 2001 From: JuMiSanAr Date: Fri, 23 Feb 2024 15:07:25 +0100 Subject: [PATCH] shopfloor: apply zero_check only if product is not a consumable --- shopfloor/services/cluster_picking.py | 7 +++++-- shopfloor/services/zone_picking.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/shopfloor/services/cluster_picking.py b/shopfloor/services/cluster_picking.py index 721f835c72..24a7957ec2 100644 --- a/shopfloor/services/cluster_picking.py +++ b/shopfloor/services/cluster_picking.py @@ -776,8 +776,11 @@ def scan_destination_pack(self, picking_batch_id, move_line_id, barcode, quantit qty_done=quantity, ) move_line.write({"qty_done": quantity, "result_package_id": bin_package.id}) - - zero_check = move_line.picking_id.picking_type_id.shopfloor_zero_check + # Only apply zero check if the product is not a consumable. + zero_check = ( + move_line.product_id.type != "consu" + and move_line.picking_id.picking_type_id.shopfloor_zero_check + ) if zero_check and move_line.location_id.planned_qty_in_location_is_empty(): return self._response_for_zero_check(batch, move_line) diff --git a/shopfloor/services/zone_picking.py b/shopfloor/services/zone_picking.py index d73283f13b..7d4256f30c 100644 --- a/shopfloor/services/zone_picking.py +++ b/shopfloor/services/zone_picking.py @@ -959,7 +959,11 @@ def _set_destination_location( location_changed = True # Zero check - zero_check = self.picking_type.shopfloor_zero_check + # Only apply zero check if the product is not a consumable. + zero_check = ( + move_line.product_id.type != "consu" + and self.picking_type.shopfloor_zero_check + ) if zero_check and move_line.location_id.planned_qty_in_location_is_empty(): response = self._response_for_zero_check(move_line) return (location_changed, response) @@ -1042,7 +1046,11 @@ def _set_destination_package(self, move_line, quantity, package): return (package_changed, response) package_changed = True # Zero check - zero_check = self.picking_type.shopfloor_zero_check + # Only apply zero check if the product is not a consumable. + zero_check = ( + move_line.product_id.type != "consu" + and self.picking_type.shopfloor_zero_check + ) if zero_check and move_line.location_id.planned_qty_in_location_is_empty(): response = self._response_for_zero_check(move_line) return (package_changed, response)