[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.
This commit is contained in:
CarlosRoca13
2022-02-18 11:15:38 +01:00
committed by Pedro M. Baeza
parent b7259bbce3
commit 42fbf75768
4 changed files with 9 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ Contributors
* Pedro M. Baeza
* David Vidal
* Sergio Teruel
* Carlos Roca
* Xavier Jimenez <xavier.jimenez@qubiq.es>

View File

@@ -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

View File

@@ -4,5 +4,6 @@
* Pedro M. Baeza
* David Vidal
* Sergio Teruel
* Carlos Roca
* Xavier Jimenez <xavier.jimenez@qubiq.es>

View File

@@ -420,6 +420,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Pedro M. Baeza</li>
<li>David Vidal</li>
<li>Sergio Teruel</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>Xavier Jimenez &lt;<a class="reference external" href="mailto:xavier.jimenez&#64;qubiq.es">xavier.jimenez&#64;qubiq.es</a>&gt;</li>