From 17332916c64779b3d4ec279c8e374a24bdc3c664 Mon Sep 17 00:00:00 2001 From: Luis Brose Date: Thu, 5 Dec 2024 15:20:23 +0100 Subject: [PATCH] [18.0][MIG] stock_available: Migration to 18.0 --- stock_available/__manifest__.py | 2 +- stock_available/models/product_product.py | 2 +- stock_available/tests/test_stock_available.py | 14 +++++++++----- stock_available/views/product_product_view.xml | 10 +++++----- stock_available/views/product_template_view.xml | 14 ++++++++------ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/stock_available/__manifest__.py b/stock_available/__manifest__.py index 33e68fff..ec33dbb2 100644 --- a/stock_available/__manifest__.py +++ b/stock_available/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock available to promise", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "author": "Numérigraphe, Sodexis, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-availability", "development_status": "Production/Stable", diff --git a/stock_available/models/product_product.py b/stock_available/models/product_product.py index cbaa7d1a..6f01cd9b 100644 --- a/stock_available/models/product_product.py +++ b/stock_available/models/product_product.py @@ -67,7 +67,7 @@ def _compute_available_quantities(self): ) def _get_search_immediately_usable_qty_domain(self): - return [("type", "=", "product")] + return [("type", "=", "consu"), ("is_storable", "=", True)] @api.model def _search_immediately_usable_qty(self, operator, value): diff --git a/stock_available/tests/test_stock_available.py b/stock_available/tests/test_stock_available.py index 323422df..70e52da5 100644 --- a/stock_available/tests/test_stock_available.py +++ b/stock_available/tests/test_stock_available.py @@ -25,10 +25,11 @@ def test01_stock_levels(self): { "name": "product A", "standard_price": 1, - "type": "product", + "type": "consu", "uom_id": uom_unit.id, "default_code": "A", "product_tmpl_id": templateAB.id, + "is_storable": True, } ) @@ -36,10 +37,11 @@ def test01_stock_levels(self): { "name": "product B", "standard_price": 1, - "type": "product", + "type": "consu", "uom_id": uom_unit.id, "default_code": "B", "product_tmpl_id": templateAB.id, + "is_storable": True, } ) @@ -137,7 +139,7 @@ def test_available_stock_multiple_location(self): { "name": "product A", "standard_price": 1, - "type": "product", + "type": "consu", "uom_id": uom_unit.id, "default_code": "A", } @@ -159,8 +161,10 @@ def test_available_stock_multiple_location(self): ) stockMoveIn._action_confirm() self.assertEqual( - productA.with_context(location=shelf1.id).immediately_usable_qty, 2.0 + productA.with_context(location=shelf1.id).immediately_usable_qty, + 2.0, ) self.assertEqual( - productA.with_context(location=shelf2.id).immediately_usable_qty, 0.0 + productA.with_context(location=shelf2.id).immediately_usable_qty, + 0.0, ) diff --git a/stock_available/views/product_product_view.xml b/stock_available/views/product_product_view.xml index d24fb864..25029f43 100644 --- a/stock_available/views/product_product_view.xml +++ b/stock_available/views/product_product_view.xml @@ -4,7 +4,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> - Quantity available to promise (variant tree) + Quantity available to promise (variant form) product.product @@ -15,7 +15,7 @@