diff --git a/setup/stock_storage_type_putaway_abc_classification_sale_stock/odoo/addons/stock_storage_type_putaway_abc_classification_sale_stock b/setup/stock_storage_type_putaway_abc_classification_sale_stock/odoo/addons/stock_storage_type_putaway_abc_classification_sale_stock new file mode 120000 index 00000000000..ea3af09d902 --- /dev/null +++ b/setup/stock_storage_type_putaway_abc_classification_sale_stock/odoo/addons/stock_storage_type_putaway_abc_classification_sale_stock @@ -0,0 +1 @@ +../../../../stock_storage_type_putaway_abc_classification_sale_stock \ No newline at end of file diff --git a/setup/stock_storage_type_putaway_abc_classification_sale_stock/setup.py b/setup/stock_storage_type_putaway_abc_classification_sale_stock/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/stock_storage_type_putaway_abc_classification_sale_stock/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/README.rst b/stock_storage_type_putaway_abc_classification_sale_stock/README.rst new file mode 100644 index 00000000000..e3bb7562286 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/README.rst @@ -0,0 +1,92 @@ +============================================= +Stock Storage Type Putaway Abc Classification +============================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github + :target: https://github.com/OCA/wms/tree/16.0/stock_storage_type_putaway_abc_classification_sale_stock + :alt: OCA/wms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_storage_type_putaway_abc_classification_sale_stock + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/285/16.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to compute the abc_storage field on products from +abc classification profiles. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +See product_abc_classification and stock_storage_type_putaway_abc modules +for configuration. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +* Laurent Mignon +* Denis Roussel + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-lmignon| image:: https://github.com/lmignon.png?size=40px + :target: https://github.com/lmignon + :alt: lmignon +.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px + :target: https://github.com/rousseldenis + :alt: rousseldenis + +Current `maintainers `__: + +|maintainer-lmignon| |maintainer-rousseldenis| + +This module is part of the `OCA/wms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/__init__.py b/stock_storage_type_putaway_abc_classification_sale_stock/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/__manifest__.py b/stock_storage_type_putaway_abc_classification_sale_stock/__manifest__.py new file mode 100644 index 00000000000..13db3bb8d76 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2021 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Storage Type Putaway Abc Classification", + "summary": """ + ABC classification for sales and warehouse management""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "website": "https://github.com/OCA/wms", + "maintainers": ["lmignon", "rousseldenis"], + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "depends": [ + "product_abc_classification_sale_stock", + "stock_storage_type_putaway_abc", + ], + "installable": True, +} diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/i18n/fr_BE.po b/stock_storage_type_putaway_abc_classification_sale_stock/i18n/fr_BE.po new file mode 100644 index 00000000000..ab1828ab4fe --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/i18n/fr_BE.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_storage_type_putaway_abc_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-03 06:51+0000\n" +"PO-Revision-Date: 2021-02-03 06:51+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_storage_type_putaway_abc_classification +#: model:ir.model,name:stock_storage_type_putaway_abc_classification.model_product_product +#, fuzzy +msgid "Product" +msgstr "Article" + +#. module: stock_storage_type_putaway_abc_classification +#: model:ir.model,name:stock_storage_type_putaway_abc_classification.model_product_template +msgid "Product Template" +msgstr "Article" + +#. module: stock_storage_type_putaway_abc_classification +#: model:ir.model,name:stock_storage_type_putaway_abc_classification.model_abc_classification_level +msgid "abc.classification.level" +msgstr "Classe ABC" + +#~ msgid "Abc storage" +#~ msgstr "Classe ABC" diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/i18n/stock_storage_type_putaway_abc_classification.pot b/stock_storage_type_putaway_abc_classification_sale_stock/i18n/stock_storage_type_putaway_abc_classification.pot new file mode 100644 index 00000000000..87aee914124 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/i18n/stock_storage_type_putaway_abc_classification.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_storage_type_putaway_abc_classification_sale_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_storage_type_putaway_abc_classification_sale_stock +#: model:ir.model,name:stock_storage_type_putaway_abc_classification_sale_stock.model_product_product +msgid "Product" +msgstr "" + +#. module: stock_storage_type_putaway_abc_classification_sale_stock +#: model:ir.model,name:stock_storage_type_putaway_abc_classification_sale_stock.model_product_template +msgid "Product Template" +msgstr "" + +#. module: stock_storage_type_putaway_abc_classification_sale_stock +#: model:ir.model,name:stock_storage_type_putaway_abc_classification_sale_stock.model_abc_classification_level +msgid "abc.classification.level" +msgstr "" + diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/models/__init__.py b/stock_storage_type_putaway_abc_classification_sale_stock/models/__init__.py new file mode 100644 index 00000000000..c74b985c556 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/models/__init__.py @@ -0,0 +1 @@ +from . import abc_classification_level, stock_location diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/models/abc_classification_level.py b/stock_storage_type_putaway_abc_classification_sale_stock/models/abc_classification_level.py new file mode 100644 index 00000000000..46e7a7c7231 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/models/abc_classification_level.py @@ -0,0 +1,24 @@ +# Copyright 2021 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + +from odoo.addons.stock_storage_type_putaway_abc.models.stock_location import ( + ABC_SELECTION, +) + + +class AbcClassificationLevel(models.Model): + + _inherit = "abc.classification.level" + _order = "percentage desc, id desc" + + name = fields.Selection(ABC_SELECTION, required=True) + + def name_get(self): + field_name = self._fields["name"] + label_by_value = dict(field_name._description_selection(self.env)) + vals = [] + for record in self: + vals.append((record.id, label_by_value[record.name])) + return vals diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/models/stock_location.py b/stock_storage_type_putaway_abc_classification_sale_stock/models/stock_location.py new file mode 100644 index 00000000000..2df0b38ae2c --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/models/stock_location.py @@ -0,0 +1,24 @@ +# Copyright 2022 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class StockLocation(models.Model): + + _inherit = "stock.location" + + def _get_sorted_leaf_locations_orderby_abc(self, products): + """ + 'self' is the location we want to put products and apply the + putaway strategy. + Evaluate the abc classification profile ids in order to retrieve + the corresponding one. + """ + location_level = products.abc_classification_product_level_ids.filtered( + lambda level, location=self: level.profile_type == "sale_stock" + and level.profile_id.warehouse_id == location.warehouse_id + ) + + if not location_level: + return super()._get_sorted_leaf_locations_orderby_abc(products) + return location_level.level_id.name diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/readme/CONTRIBUTORS.rst b/stock_storage_type_putaway_abc_classification_sale_stock/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..7c2997e3f54 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Laurent Mignon +* Denis Roussel diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/readme/DESCRIPTION.rst b/stock_storage_type_putaway_abc_classification_sale_stock/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..b6e1f1d6fa2 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows to compute the abc_storage field on products from +abc classification profiles. diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/readme/USAGE.rst b/stock_storage_type_putaway_abc_classification_sale_stock/readme/USAGE.rst new file mode 100644 index 00000000000..f19e1204263 --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/readme/USAGE.rst @@ -0,0 +1,2 @@ +See product_abc_classification and stock_storage_type_putaway_abc modules +for configuration. diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/static/description/index.html b/stock_storage_type_putaway_abc_classification_sale_stock/static/description/index.html new file mode 100644 index 00000000000..3d43e800baf --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/static/description/index.html @@ -0,0 +1,429 @@ + + + + + + +Stock Storage Type Putaway Abc Classification + + + +
+

Stock Storage Type Putaway Abc Classification

+ + +

Beta License: AGPL-3 OCA/wms Translate me on Weblate Try me on Runbot

+

This module allows to compute the abc_storage field on products from +abc classification profiles.

+

Table of contents

+ +
+

Usage

+

See product_abc_classification and stock_storage_type_putaway_abc modules +for configuration.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainers:

+

lmignon rousseldenis

+

This module is part of the OCA/wms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/tests/__init__.py b/stock_storage_type_putaway_abc_classification_sale_stock/tests/__init__.py new file mode 100644 index 00000000000..d787f59ca2f --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/tests/__init__.py @@ -0,0 +1 @@ +from . import test_abc_storage diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/tests/common.py b/stock_storage_type_putaway_abc_classification_sale_stock/tests/common.py new file mode 100644 index 00000000000..00c96b560db --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/tests/common.py @@ -0,0 +1,85 @@ +# Copyright 2021 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from psycopg2.extensions import AsIs + +from odoo.addons.product_abc_classification.tests import common +from odoo.addons.stock_storage_type.tests.common import TestStorageTypeCommon + + +class ABCClassificationLevelCase( + TestStorageTypeCommon, common.ABCClassificationLevelCase +): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create( + { + "name": "Test product", + "uom_id": cls.env.ref("uom.product_uom_unit").id, + "type": "product", + "weight": 10.0, + } + ) + # force profile using SQL to avoid trouble if tests are ran with + # alc_product_abc_classification_picking_zone installed + + cls._link_profile(cls.product, cls.classification_profile) + + @classmethod + def _link_profile(cls, products, profile): + product_profiles_field = cls.env["product.product"]._fields[ + "abc_classification_profile_ids" + ] + product_profiles_product_col = product_profiles_field.column1 + product_profiles_profile_col = product_profiles_field.column2 + product_profiles_table = product_profiles_field.relation + + template_profiles_field = cls.env["product.template"]._fields[ + "abc_classification_profile_ids" + ] + template_profiles_product_col = template_profiles_field.column1 + template_profiles_profile_col = template_profiles_field.column2 + template_profiles_table = template_profiles_field.relation + + for product in products: + cls.env.cr.execute( + """ + INSERT into %(table)s (%(product_col)s, %(profile_col)s) + VALUES (%(product_id)s, %(profile_id)s) + ; + """, + { + "table": AsIs(product_profiles_table), + "product_col": AsIs(product_profiles_product_col), + "profile_col": AsIs(product_profiles_profile_col), + "product_id": product.id, + "profile_id": profile.id, + }, + ) + cls.env.cr.execute( + """ + INSERT into %(table)s (%(product_col)s, %(profile_col)s) + VALUES (%(template_id)s, %(profile_id)s) + """, + { + "table": AsIs(template_profiles_table), + "product_col": AsIs(template_profiles_product_col), + "profile_col": AsIs(template_profiles_profile_col), + "template_id": product.product_tmpl_id.id, + "profile_id": profile.id, + }, + ) + + @classmethod + def _set_abc_level(cls, product, level): + product.abc_classification_product_level_ids.filtered( + lambda a, lvl=level: a.profile_id == lvl.profile_id + ).unlink() + product.abc_classification_product_level_ids.create( + { + "product_id": product.id, + "computed_level_id": level.id, + "profile_id": level.profile_id.id, + } + ) diff --git a/stock_storage_type_putaway_abc_classification_sale_stock/tests/test_abc_storage.py b/stock_storage_type_putaway_abc_classification_sale_stock/tests/test_abc_storage.py new file mode 100644 index 00000000000..80b03f2862c --- /dev/null +++ b/stock_storage_type_putaway_abc_classification_sale_stock/tests/test_abc_storage.py @@ -0,0 +1,211 @@ +# Copyright 2022 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from .common import ABCClassificationLevelCase + + +class TestProduct(ABCClassificationLevelCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.ABCClassificationProfile._fields["profile_type"].selection = [ + ("sale_stock", "Sale Stock") + ] + cls.classification_profile_sale_stock = cls.env.ref( + "product_abc_classification_sale_stock.abc_classification_profile_sale_stock" + ) + levels = cls.classification_profile_sale_stock.level_ids + cls.classification_level_a = levels.filtered(lambda l: l.name == "a") + cls.classification_level_b = levels.filtered(lambda l: l.name == "b") + cls.classification_level_c = levels.filtered(lambda l: l.name == "c") + + cls.cardboxes_location.write({"pack_putaway_strategy": "abc"}) + cls.cardboxes_bin_2_location.write( + {"abc_storage": "a", "pack_putaway_sequence": 3} + ) + cls.cardboxes_bin_4_location.write( + {"abc_storage": "b", "pack_putaway_sequence": 1} + ) + cls.cardboxes_bin_1_location.write( + {"abc_storage": "b", "pack_putaway_sequence": 2} + ) + cls.cardboxes_bin_3_location.write( + {"abc_storage": "c", "pack_putaway_sequence": 1} + ) + + # Set classification profile on product + cls.product.abc_classification_profile_ids = ( + cls.classification_profile_sale_stock + ) + + cls._set_warehouse_2() + + @classmethod + def _set_warehouse_2(cls): + # We configure multi warehouse - copying locations + # We apply a different abc storage per location than first + # warehouse + cls.warehouse_2 = cls.env["stock.warehouse"].create( + {"name": "Warehouse 2 (Company 1)", "code": "WH2"} + ) + cls.wh_2_stock_location_cardboxes = cls.cardboxes_location.copy( + {"location_id": cls.warehouse_2.lot_stock_id.id} + ) + cls.wh_2_cardboxes_bin_1_location = cls.cardboxes_bin_1_location.copy( + {"location_id": cls.wh_2_stock_location_cardboxes.id} + ) + cls.wh_2_cardboxes_bin_2_location = cls.cardboxes_bin_2_location.copy( + {"location_id": cls.wh_2_stock_location_cardboxes.id} + ) + cls.wh_2_cardboxes_bin_3_location = cls.cardboxes_bin_3_location.copy( + {"location_id": cls.wh_2_stock_location_cardboxes.id} + ) + cls.wh_2_cardboxes_bin_4_location = cls.cardboxes_bin_4_location.copy( + {"location_id": cls.wh_2_stock_location_cardboxes.id} + ) + cls.wh_2_cardboxes_bin_1_location.write( + {"abc_storage": "a", "pack_putaway_sequence": 2} + ) + cls.wh_2_cardboxes_bin_2_location.write( + {"abc_storage": "b", "pack_putaway_sequence": 3} + ) + cls.wh_2_cardboxes_bin_3_location.write( + {"abc_storage": "c", "pack_putaway_sequence": 1} + ) + cls.wh_2_cardboxes_bin_4_location.write( + {"abc_storage": "c", "pack_putaway_sequence": 2} + ) + + cls.wh2_profile = cls.env["abc.classification.profile"].create( + { + "name": "Sale Stock Profile WH2", + "profile_type": "sale_stock", + "warehouse_id": cls.warehouse_2.id, + "period": "365", + "level_ids": [ + ( + 0, + 0, + { + "name": "a", + "percentage": 80, + "percentage_products": 20, + }, + ), + ( + 0, + 0, + { + "name": "b", + "percentage": 15, + "percentage_products": 30, + }, + ), + ( + 0, + 0, + { + "name": "c", + "percentage": 5, + "percentage_products": 50, + }, + ), + ], + } + ) + cls.product.abc_classification_profile_ids |= cls.wh2_profile + + def test_abc_storage_b(self): + # Set putaway strategy on carboxes locations as 'abc', + # Add an abc classification on product that should result in 'b' classification + self.product_level_b = self.ProductLevel.create( + { + "product_id": self.product.id, + "computed_level_id": self.classification_level_b.id, + "profile_id": self.classification_profile_sale_stock.id, + } + ) + + ordered_locations = self.cardboxes_location.get_storage_locations(self.product) + # We check that location order is: + # B (1), B (2), C, A + self.assertEqual( + ordered_locations.ids, + ( + self.cardboxes_bin_4_location + | self.cardboxes_bin_1_location + | self.cardboxes_bin_3_location + | self.cardboxes_bin_2_location + ).ids, + ) + + def test_abc_storage_a(self): + # Set putaway strategy on carboxes locations as 'abc', + # Add an abc classification on product that should result in 'a' classification + self.product_level_a = self.ProductLevel.create( + { + "product_id": self.product.id, + "computed_level_id": self.classification_level_a.id, + "profile_id": self.classification_profile_sale_stock.id, + } + ) + ordered_locations = self.cardboxes_location.get_storage_locations(self.product) + # We check that location order is: + # A, B (1), B (2), C + self.assertEqual( + ordered_locations.ids, + ( + self.cardboxes_bin_2_location + | self.cardboxes_bin_4_location + | self.cardboxes_bin_1_location + | self.cardboxes_bin_3_location + ).ids, + ) + + self.wh2_product_level_a = self.ProductLevel.create( + { + "product_id": self.product.id, + "computed_level_id": self.wh2_profile.level_ids.filtered( + lambda l: l.name == "a" + ).id, + "profile_id": self.wh2_profile.id, + } + ) + + # We check the order for Warehouse 2 + ordered_locations = self.wh_2_stock_location_cardboxes.get_storage_locations( + self.product + ) + # We check that location order is: + # A, B (1), B (2), C + self.assertEqual( + ordered_locations.ids, + ( + self.wh_2_cardboxes_bin_1_location + | self.wh_2_cardboxes_bin_2_location + | self.wh_2_cardboxes_bin_3_location + | self.wh_2_cardboxes_bin_4_location + ).ids, + ) + + # We delete the profile for product on warehouse 2 + self.wh2_product_level_a.unlink() + + # We check the classification applied is fallback on abc_storage field + # on product level + + self.assertEqual("b", self.product.abc_storage) + ordered_locations = self.wh_2_stock_location_cardboxes.get_storage_locations( + self.product + ) + # We check that location order is: + # B (1), B (2), C, A + self.assertEqual( + ordered_locations.ids, + ( + self.wh_2_cardboxes_bin_2_location + | self.wh_2_cardboxes_bin_3_location + | self.wh_2_cardboxes_bin_4_location + | self.wh_2_cardboxes_bin_1_location + ).ids, + )