diff --git a/stock_product_pack/README.rst b/stock_product_pack/README.rst index 033cd84c0..3ee764de0 100644 --- a/stock_product_pack/README.rst +++ b/stock_product_pack/README.rst @@ -82,6 +82,10 @@ Contributors - Sergio Teruel - João Marques +- `ADHOC SA `__: + + - Bruno Zanotti + Maintainers ----------- diff --git a/stock_product_pack/__manifest__.py b/stock_product_pack/__manifest__.py index 7ab78dc1c..f58301350 100644 --- a/stock_product_pack/__manifest__.py +++ b/stock_product_pack/__manifest__.py @@ -5,7 +5,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Stock product Pack", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Warehouse", "summary": "This module allows you to get the right available quantities " "of the packs", diff --git a/stock_product_pack/models/product_product.py b/stock_product_pack/models/product_product.py index ba2989823..32142dc7e 100644 --- a/stock_product_pack/models/product_product.py +++ b/stock_product_pack/models/product_product.py @@ -4,7 +4,7 @@ import math -from odoo import models +from odoo import api, models class ProductProduct(models.Model): @@ -13,10 +13,10 @@ class ProductProduct(models.Model): def _compute_quantities_dict( self, lot_id, owner_id, package_id, from_date=False, to_date=False ): - res = super()._compute_quantities_dict( + packs = self.filtered("pack_ok") + res = super(ProductProduct, self - packs)._compute_quantities_dict( lot_id, owner_id, package_id, from_date=from_date, to_date=to_date ) - packs = self.filtered("pack_ok") for product in packs.with_context(prefetch_fields=False): pack_qty_available = [] pack_virtual_available = [] @@ -48,6 +48,23 @@ def _compute_quantities_dict( } return res + @api.depends( + "stock_move_ids.product_qty", + "pack_line_ids.product_id.stock_move_ids.product_qty", + "stock_move_ids.state", + "pack_line_ids.product_id.stock_move_ids.state", + "stock_move_ids.quantity", + "pack_line_ids.product_id.stock_move_ids.quantity", + ) + @api.depends_context( + "lot_id", + "owner_id", + "package_id", + "from_date", + "to_date", + "location", + "warehouse", + ) def _compute_quantities(self): """In v13 Odoo introduces a filter for products not services. To keep how it was working on v12 we try to get stock for diff --git a/stock_product_pack/readme/CONTRIBUTORS.md b/stock_product_pack/readme/CONTRIBUTORS.md index 8f03a6bba..139c58419 100644 --- a/stock_product_pack/readme/CONTRIBUTORS.md +++ b/stock_product_pack/readme/CONTRIBUTORS.md @@ -3,3 +3,5 @@ - Pedro M. Baeza - Sergio Teruel - João Marques +- [ADHOC SA](https://www.adhoc.com.ar): + - Bruno Zanotti diff --git a/stock_product_pack/static/description/index.html b/stock_product_pack/static/description/index.html index d1d398c9c..7fc671036 100644 --- a/stock_product_pack/static/description/index.html +++ b/stock_product_pack/static/description/index.html @@ -1,4 +1,3 @@ - @@ -429,6 +428,10 @@

Contributors

  • João Marques
  • +
  • ADHOC SA: +
  • diff --git a/stock_product_pack/tests/test_stock_product_pack.py b/stock_product_pack/tests/test_stock_product_pack.py index cf789af2b..f12ee7af3 100644 --- a/stock_product_pack/tests/test_stock_product_pack.py +++ b/stock_product_pack/tests/test_stock_product_pack.py @@ -9,7 +9,7 @@ _logger = logging.getLogger(__name__) -class TestSaleProductPack(TransactionCase): +class TestStockProductPack(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -167,12 +167,13 @@ def test_compute_quantities_dict(self): self.assertEqual(self.pack_dc.virtual_available, 5) self.assertEqual(self.pack_dc.qty_available, 0) wizard_dict = picking.button_validate() - wizard = Form( - self.env[(wizard_dict.get("res_model"))].with_context( - **wizard_dict["context"] - ) - ).save() - wizard.process() + if wizard_dict is not True: + wizard = Form( + self.env[(wizard_dict.get("res_model"))].with_context( + **wizard_dict["context"] + ) + ).save() + wizard.process() self.assertEqual(self.pack_dc.virtual_available, 5) self.assertEqual(self.pack_dc.qty_available, 5) diff --git a/stock_product_pack/views/product_template_views.xml b/stock_product_pack/views/product_template_views.xml index 89c459003..79239a54a 100644 --- a/stock_product_pack/views/product_template_views.xml +++ b/stock_product_pack/views/product_template_views.xml @@ -11,7 +11,7 @@