From a7e512cd8c341f5f5b8f7d6e2c979465834c3b6b Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Mon, 2 Dec 2024 09:02:54 +0100 Subject: [PATCH] [IMP] create whs lists only for not excluded products --- connector_whs/models/mrp.py | 1 + connector_whs/models/repair.py | 2 ++ connector_whs/models/stock.py | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/connector_whs/models/mrp.py b/connector_whs/models/mrp.py index 324cf280..c4dbb012 100644 --- a/connector_whs/models/mrp.py +++ b/connector_whs/models/mrp.py @@ -218,6 +218,7 @@ def _generate_whs(self): continue if ( move.product_id.type == "product" + and not move.product_id.exclude_from_whs and move.location_id == production.location_src_id ): if not num_lista: diff --git a/connector_whs/models/repair.py b/connector_whs/models/repair.py index 5a5496ba..3b4d4e0f 100644 --- a/connector_whs/models/repair.py +++ b/connector_whs/models/repair.py @@ -23,12 +23,14 @@ def action_repair_end(self): and x.move_id.state == "done" and x.move_id.product_id.type == "product" and x.move_id.location_id == location_id + and not x.move_id.product_id.exclude_from_whs ) remove_operations = repair.operations.filtered( lambda x: x.move_id and x.move_id.state == "done" and x.move_id.product_id.type == "product" and x.move_id.location_dest_id == location_id + and not x.move_id.product_id.exclude_from_whs ) if add_operations: num_lista = self.env["ir.sequence"].next_by_code("hyddemo.whs.liste") diff --git a/connector_whs/models/stock.py b/connector_whs/models/stock.py index 42cfebea..ac5e1c03 100644 --- a/connector_whs/models/stock.py +++ b/connector_whs/models/stock.py @@ -231,7 +231,13 @@ def create_whs_list(self): in self.env.context.get("picking_ids_not_to_backorder", []) ): continue - moves = self.filtered(lambda m: m.picking_id == picking) + moves = self.filtered( + lambda m: m.picking_id == picking + and m.product_type == "product" + and not m.product_id.exclude_from_whs + ) + if not moves: + continue list_number = False # get existing active list_number to append new whslist list_numbers = list( set(