diff --git a/setup/stock_available_base_exclude_location/odoo/__init__.py b/setup/stock_available_base_exclude_location/odoo/__init__.py deleted file mode 100644 index de40ea7ca..000000000 --- a/setup/stock_available_base_exclude_location/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/stock_available_base_exclude_location/odoo/addons/__init__.py b/setup/stock_available_base_exclude_location/odoo/addons/__init__.py deleted file mode 100644 index de40ea7ca..000000000 --- a/setup/stock_available_base_exclude_location/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/stock_available_base_exclude_location/__manifest__.py b/stock_available_base_exclude_location/__manifest__.py index 109e94d2f..cea24b301 100644 --- a/stock_available_base_exclude_location/__manifest__.py +++ b/stock_available_base_exclude_location/__manifest__.py @@ -5,7 +5,7 @@ "name": "Stock Available Base Exclude Location", "summary": """ Base module to exclude locations for product available quantities""", - "version": "10.0.1.0.1", + "version": "14.0.1.0.0", "category": "Warehouse", "maintainers": ["rousseldenis"], "license": "AGPL-3", diff --git a/stock_available_base_exclude_location/models/product_product.py b/stock_available_base_exclude_location/models/product_product.py index 605002b4f..296d3d602 100644 --- a/stock_available_base_exclude_location/models/product_product.py +++ b/stock_available_base_exclude_location/models/product_product.py @@ -18,9 +18,11 @@ class ProductProduct(models.Model): :param compute_child: :return: """ - domain_quant_loc, domain_move_in_loc, domain_move_out_loc = super( - ProductProduct, self - )._get_domain_locations_new( + ( + domain_quant_loc, + domain_move_in_loc, + domain_move_out_loc, + ) = super()._get_domain_locations_new( location_ids=location_ids, company_id=company_id, compute_child=compute_child, @@ -35,7 +37,13 @@ class ProductProduct(models.Model): ) domain_move_in_loc = expression.AND( [ - [("location_dest_id", "not in", excluded_location_ids.ids)], + [ + ( + "location_dest_id", + "not in", + excluded_location_ids.ids, + ) + ], domain_quant_loc, ] ) diff --git a/stock_available_base_exclude_location/models/stock_exclude_location_mixin.py b/stock_available_base_exclude_location/models/stock_exclude_location_mixin.py index dcceb7d2f..e6877a8a4 100644 --- a/stock_available_base_exclude_location/models/stock_exclude_location_mixin.py +++ b/stock_available_base_exclude_location/models/stock_exclude_location_mixin.py @@ -7,6 +7,9 @@ from odoo import fields, models class StockExcludeLocationMixin(models.AbstractModel): _name = "stock.exclude.location.mixin" + _description = ( + "technical base module to allow defining excluded locations on an Odoo model" + ) stock_excluded_location_ids = fields.Many2many( comodel_name="stock.location", diff --git a/stock_available_base_exclude_location/readme/CONTRIBUTORS.rst b/stock_available_base_exclude_location/readme/CONTRIBUTORS.rst index 9179ee4b8..2cb5bc6f5 100644 --- a/stock_available_base_exclude_location/readme/CONTRIBUTORS.rst +++ b/stock_available_base_exclude_location/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Denis Roussel +* Xavier Bouquiaux diff --git a/stock_available_base_exclude_location/tests/test_stock_exclude_location.py b/stock_available_base_exclude_location/tests/test_stock_exclude_location.py index a249f5150..0f441bae5 100644 --- a/stock_available_base_exclude_location/tests/test_stock_exclude_location.py +++ b/stock_available_base_exclude_location/tests/test_stock_exclude_location.py @@ -16,7 +16,7 @@ class TestExcludeLocation(SavepointCase): cls.loader.update_registry((ResPartner,)) cls.fake = cls.env["res.partner"].create({"name": "name"}) - cls.location_shop = cls.env.ref("stock.stock_location_shop0") + cls.location_shop = cls.env.ref("stock.stock_location_stock") vals = {"location_id": cls.location_shop.id, "name": "Sub Location 1"} cls.sub_location_1 = cls.env["stock.location"].create(vals) cls.sub_location_1._parent_store_compute() @@ -33,14 +33,13 @@ class TestExcludeLocation(SavepointCase): :param product: product.product recordset :param qty: float """ - wizard = self.env["stock.change.product.qty"].create( + self.env["stock.quant"].with_context(inventory_mode=True).create( { "product_id": product.id, - "new_quantity": qty, "location_id": location.id, + "inventory_quantity": qty, } ) - wizard.change_product_qty() def test_exclude_location(self): # Add different levels of stock for product as : @@ -54,6 +53,7 @@ class TestExcludeLocation(SavepointCase): qty = self.product.with_context( excluded_location_ids=self.fake.stock_excluded_location_ids ).qty_available - self.assertEquals(50.0, qty) + self.assertEqual(50.0, qty) + self.product.invalidate_cache() qty = self.product.qty_available - self.assertEquals(75.0, qty) + self.assertEqual(75.0, qty) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..66bc2cbae --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo_test_helper