From 42fbf757688fa3cf63b4798c98bd6ceb77be963e Mon Sep 17 00:00:00 2001 From: CarlosRoca13 Date: Fri, 18 Feb 2022 11:15:38 +0100 Subject: [PATCH] [FIX] stock_inventory_preparation_filter: Filtering by lots is adding all lots of products Before this patch, if we create a stock inventory for some lots, we get a line for each lot of the products difined on lots. After this patch, we get the lines for the lots defined. --- stock_inventory_preparation_filter/README.rst | 1 + .../models/stock_inventory.py | 6 ++++++ stock_inventory_preparation_filter/readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 1 + 4 files changed, 9 insertions(+) diff --git a/stock_inventory_preparation_filter/README.rst b/stock_inventory_preparation_filter/README.rst index e6784f253..1afa57aa1 100644 --- a/stock_inventory_preparation_filter/README.rst +++ b/stock_inventory_preparation_filter/README.rst @@ -71,6 +71,7 @@ Contributors * Pedro M. Baeza * David Vidal * Sergio Teruel + * Carlos Roca * Xavier Jimenez diff --git a/stock_inventory_preparation_filter/models/stock_inventory.py b/stock_inventory_preparation_filter/models/stock_inventory.py index 3128207dd..fa1281a47 100644 --- a/stock_inventory_preparation_filter/models/stock_inventory.py +++ b/stock_inventory_preparation_filter/models/stock_inventory.py @@ -67,3 +67,9 @@ class StockInventory(models.Model): if products: inventory.product_ids = [(6, 0, products.ids)] return super()._action_start() + + def _get_inventory_lines_values(self): + vals = super()._get_inventory_lines_values() + if self.filter == "lots": + vals = list(filter(lambda x: x["prod_lot_id"] in self.lot_ids.ids, vals)) + return vals diff --git a/stock_inventory_preparation_filter/readme/CONTRIBUTORS.rst b/stock_inventory_preparation_filter/readme/CONTRIBUTORS.rst index 73ee8a368..1f7433cf8 100644 --- a/stock_inventory_preparation_filter/readme/CONTRIBUTORS.rst +++ b/stock_inventory_preparation_filter/readme/CONTRIBUTORS.rst @@ -4,5 +4,6 @@ * Pedro M. Baeza * David Vidal * Sergio Teruel + * Carlos Roca * Xavier Jimenez diff --git a/stock_inventory_preparation_filter/static/description/index.html b/stock_inventory_preparation_filter/static/description/index.html index 2d7b90ae1..ca1cc5a6b 100644 --- a/stock_inventory_preparation_filter/static/description/index.html +++ b/stock_inventory_preparation_filter/static/description/index.html @@ -420,6 +420,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Pedro M. Baeza
  • David Vidal
  • Sergio Teruel
  • +
  • Carlos Roca
  • Xavier Jimenez <xavier.jimenez@qubiq.es>