diff --git a/setup/stock_location_zone/odoo/addons/stock_location_zone b/setup/stock_location_zone/odoo/addons/stock_location_zone new file mode 120000 index 000000000..7d216d8f9 --- /dev/null +++ b/setup/stock_location_zone/odoo/addons/stock_location_zone @@ -0,0 +1 @@ +../../../../stock_location_zone \ No newline at end of file diff --git a/setup/stock_location_zone/setup.py b/setup/stock_location_zone/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_location_zone/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_location_zone/README.rst b/stock_location_zone/README.rst new file mode 100644 index 000000000..b4dd2db27 --- /dev/null +++ b/stock_location_zone/README.rst @@ -0,0 +1,100 @@ +=================== +Stock Location Zone +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_location_zone + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_location_zone + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces Zone concept on stock locations to allow better +classification of stock locations in a warehouse. + +Locations are then classified by location kinds that could be: + +* Zone: locations that are flagged as being zones. Zones are subdivisions of the warehouse for splitting picking operations. A picking operator work in a zone and can pick from any location of the zone. +* Area: locations with children that are part of a zone. Areas are subdivisions of the warehouse for put-away operations. Each area has storage characteristics and strategy, e.g. area for pallets, shelf for boxes... +* Bin: locations without children that are part of a zone +* Stock: internal locations whose parent is a view +* Other: any other location + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +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 +~~~~~~~ + +* BCIM +* Okia +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Syvain Van Hoof (Okia sprl) +* Jacques-Etienne Baudoux (BCIM) +* Guewen Baconnier (Camptocamp) +* Akim Juillerat +* Phuc Tran Thanh + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Camptocamp + +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. + +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_location_zone/__init__.py b/stock_location_zone/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_location_zone/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_location_zone/__manifest__.py b/stock_location_zone/__manifest__.py new file mode 100644 index 000000000..8f5f290d3 --- /dev/null +++ b/stock_location_zone/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2017 Syvain Van Hoof (Okia sprl) +# Copyright 2016-2019 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Stock Location Zone", + "version": "16.0.1.0.0", + "author": "BCIM, Okia, Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "summary": "Classify locations with zones.", + "category": "Warehouse", + "depends": ["stock"], + "data": ["views/stock_location.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/stock_location_zone/i18n/stock_location_zone.pot b/stock_location_zone/i18n/stock_location_zone.pot new file mode 100644 index 000000000..f0a9dc16c --- /dev/null +++ b/stock_location_zone/i18n/stock_location_zone.pot @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_zone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\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_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__area +msgid "Area" +msgstr "" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Area location" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__bin +msgid "Bin" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__display_name +msgid "Display Name" +msgstr "" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Group By" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,help:stock_location_zone.field_stock_location__location_kind +msgid "" +"Group location according to their kinds: * Zone: locations that are flagged " +"as being zones * Area: locations with children that are part of a zone * " +"Bin: locations without children that are part of a zone * Stock: internal " +"locations whose parent is a view * Other: any other location" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__id +msgid "ID" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model,name:stock_location_zone.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__is_zone +msgid "Is a Zone Location?" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location____last_update +msgid "Last Modified on" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__area_location_id +msgid "Location Area" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__location_kind +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Location Kind" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__zone_location_id +msgid "Location Zone" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__stock +msgid "Main Stock" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,help:stock_location_zone.field_stock_location__is_zone +msgid "Mark to define this location as a zone" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__other +msgid "Other" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__zone +msgid "Zone" +msgstr "" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Zone location" +msgstr "" diff --git a/stock_location_zone/i18n/zh_CN.po b/stock_location_zone/i18n/zh_CN.po new file mode 100644 index 000000000..3dbcf5af2 --- /dev/null +++ b/stock_location_zone/i18n/zh_CN.po @@ -0,0 +1,195 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_zone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-10-12 16:36+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__area +msgid "Area" +msgstr "区域" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Area location" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__bin +msgid "Bin" +msgstr "箱子" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Group By" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,help:stock_location_zone.field_stock_location__location_kind +msgid "" +"Group location according to their kinds: * Zone: locations that are flagged " +"as being zones * Area: locations with children that are part of a zone * " +"Bin: locations without children that are part of a zone * Stock: internal " +"locations whose parent is a view * Other: any other location" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model,name:stock_location_zone.model_stock_location +msgid "Inventory Locations" +msgstr "库存位置" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__is_zone +#, fuzzy +msgid "Is a Zone Location?" +msgstr "库存位置" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__area_location_id +#, fuzzy +msgid "Location Area" +msgstr "位置名称格式" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__location_kind +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Location Kind" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__zone_location_id +#, fuzzy +msgid "Location Zone" +msgstr "拣货区域" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__stock +msgid "Main Stock" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields,help:stock_location_zone.field_stock_location__is_zone +msgid "Mark to define this location as a zone" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__other +msgid "Other" +msgstr "" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__zone +msgid "Zone" +msgstr "" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +#, fuzzy +msgid "Zone location" +msgstr "库存位置" + +#~ msgid "Box (X)" +#~ msgstr "盒子(X)" + +#~ msgid "Box (Y)" +#~ msgstr "盒子(Y)" + +#~ msgid "Box (Z)" +#~ msgstr "盒子(Z)" + +#~ msgid "Code" +#~ msgstr "代码" + +#~ msgid "Corridor" +#~ msgstr "过道" + +#~ msgid "Created by" +#~ msgstr "创建者" + +#~ msgid "Created on" +#~ msgstr "创建时间" + +#~ msgid "Define the picking zones of your warehouses" +#~ msgstr "定义仓库的拣货区域" + +#~ msgid "Display Name" +#~ msgstr "显示名称" + +#~ msgid "" +#~ "Format string that will compute the name of the location. Use location " +#~ "fields. Example: '{area}-{corridor:0>2}.{rack:0>3}.{level:0>2}'" +#~ msgstr "" +#~ "格式字符串,用于计算位置名称。使用位置字段。例: '{area}-{corridor:0>2}." +#~ "{rack:0>3}.{level:0>2}'" + +#~ msgid "Height on the shelf" +#~ msgstr "架子上的高度" + +#~ msgid "House number" +#~ msgstr "门牌号码" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Kind" +#~ msgstr "种类" + +#~ msgid "Last Modified on" +#~ msgstr "最后修改时间" + +#~ msgid "Last Updated by" +#~ msgstr "最后更新者" + +#~ msgid "Last Updated on" +#~ msgstr "最后更新时间" + +#~ msgid "Level" +#~ msgstr "层级" + +#~ msgid "Name" +#~ msgstr "名称" + +#~ msgid "Optional localization details, for information purpose only" +#~ msgstr "可选的本地化详细信息,仅供参考" + +#~ msgid "Pick Type" +#~ msgstr "拣货类型" + +#~ msgid "Picking Zones" +#~ msgstr "拣货区域" + +#~ msgid "Picking type for operations from this location" +#~ msgstr "从此位置进行操作的拣货类型" + +#~ msgid "Picking zone" +#~ msgstr "拣货区域" + +#~ msgid "Rack" +#~ msgstr "架子" + +#~ msgid "Row" +#~ msgstr "行" + +#~ msgid "Side in the street" +#~ msgstr "在过道上" + +#~ msgid "Stock Picking Zone" +#~ msgstr "拣货区域" + +#~ msgid "Street" +#~ msgstr "过道" + +#~ msgid "The picking zone code must be unique" +#~ msgstr "拣货区域代码必须唯一" diff --git a/stock_location_zone/models/__init__.py b/stock_location_zone/models/__init__.py new file mode 100644 index 000000000..88493e35d --- /dev/null +++ b/stock_location_zone/models/__init__.py @@ -0,0 +1 @@ +from . import stock_location diff --git a/stock_location_zone/models/stock_location.py b/stock_location_zone/models/stock_location.py new file mode 100644 index 000000000..86a05ce9b --- /dev/null +++ b/stock_location_zone/models/stock_location.py @@ -0,0 +1,110 @@ +# Copyright 2017 Sylvain Van Hoof +# Copyright 2018-2019 Jacques-Etienne Baudoux (BCIM sprl) +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class StockLocation(models.Model): + _inherit = "stock.location" + + is_zone = fields.Boolean( + string="Is a Zone Location?", help="Mark to define this location as a zone" + ) + + zone_location_id = fields.Many2one( + "stock.location", + string="Location Zone", + compute="_compute_zone_location_id", + store=True, + index=True, + recursive=True, + ) + area_location_id = fields.Many2one( + "stock.location", + string="Location Area", + compute="_compute_zone_location_id", + store=True, + recursive=True, + ) + + location_kind = fields.Selection( + [ + ("zone", "Zone"), + ("area", "Area"), + ("bin", "Bin"), + ("stock", "Main Stock"), + ("other", "Other"), + ], + compute="_compute_location_kind", + store=True, + help="Group location according to their kinds: " + "* Zone: locations that are flagged as being zones " + "* Area: locations with children that are part of a zone " + "* Bin: locations without children that are part of a zone " + "* Stock: internal locations whose parent is a view " + "* Other: any other location", + ) + + @api.depends( + "is_zone", "location_id.zone_location_id", "location_id.area_location_id" + ) + def _compute_zone_location_id(self): + self_browse = self.browse() + self.update({"zone_location_id": self_browse, "area_location_id": self_browse}) + for location in self: + if location.is_zone: + location.zone_location_id = location + continue + parent = location.location_id + if parent.zone_location_id: + # If we have more than one level of area in a zone, + # the grouping is done by the first level + if parent.area_location_id: + area_location_id = parent.area_location_id + else: + area_location_id = location + location.update( + { + "zone_location_id": parent.zone_location_id, + "area_location_id": area_location_id, + } + ) + + @api.depends( + "usage", + "location_id.usage", + "child_ids", + "area_location_id", + "zone_location_id", + ) + def _compute_location_kind(self): + for location in self: + if location.zone_location_id and not location.area_location_id: + location.location_kind = "zone" + continue + + parent = location.location_id + if location.usage == "internal" and parent.usage == "view": + # Internal locations whose parent is view are main stocks + location.location_kind = "stock" + elif ( + # Internal locations having a zone and no children are bins + location.usage == "internal" + and location.zone_location_id + and location.area_location_id + and not location.child_ids + ): + location.location_kind = "bin" + elif ( + location.usage == "internal" + and location.zone_location_id + and location.area_location_id + and location.child_ids + ): + # Internal locations having a zone and children are areas + location.location_kind = "area" + else: + # All the rest are other locations + location.location_kind = "other" diff --git a/stock_location_zone/readme/CONTRIBUTORS.rst b/stock_location_zone/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..89595a403 --- /dev/null +++ b/stock_location_zone/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Syvain Van Hoof (Okia sprl) +* Jacques-Etienne Baudoux (BCIM) +* Guewen Baconnier (Camptocamp) +* Akim Juillerat +* Phuc Tran Thanh +* Denis Roussel diff --git a/stock_location_zone/readme/CREDITS.rst b/stock_location_zone/readme/CREDITS.rst new file mode 100644 index 000000000..f5cc070c7 --- /dev/null +++ b/stock_location_zone/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Camptocamp diff --git a/stock_location_zone/readme/DESCRIPTION.rst b/stock_location_zone/readme/DESCRIPTION.rst new file mode 100644 index 000000000..7b3ca7af2 --- /dev/null +++ b/stock_location_zone/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ +This module introduces Zone concept on stock locations to allow better +classification of stock locations in a warehouse. + +Locations are then classified by location kinds that could be: + +* Zone: locations that are flagged as being zones. Zones are subdivisions of the warehouse for splitting picking operations. A picking operator work in a zone and can pick from any location of the zone. +* Area: locations with children that are part of a zone. Areas are subdivisions of the warehouse for put-away operations. Each area has storage characteristics and strategy, e.g. area for pallets, shelf for boxes... +* Bin: locations without children that are part of a zone +* Stock: internal locations whose parent is a view +* Other: any other location diff --git a/stock_location_zone/static/description/icon.png b/stock_location_zone/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_location_zone/static/description/icon.png differ diff --git a/stock_location_zone/static/description/index.html b/stock_location_zone/static/description/index.html new file mode 100644 index 000000000..3169e48de --- /dev/null +++ b/stock_location_zone/static/description/index.html @@ -0,0 +1,448 @@ + + + + + + +Stock Location Zone + + + +
+

Stock Location Zone

+ + +

Alpha License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

This module introduces Zone concept on stock locations to allow better +classification of stock locations in a warehouse.

+

Locations are then classified by location kinds that could be:

+
    +
  • Zone: locations that are flagged as being zones. Zones are subdivisions of the warehouse for splitting picking operations. A picking operator work in a zone and can pick from any location of the zone.
  • +
  • Area: locations with children that are part of a zone. Areas are subdivisions of the warehouse for put-away operations. Each area has storage characteristics and strategy, e.g. area for pallets, shelf for boxes…
  • +
  • Bin: locations without children that are part of a zone
  • +
  • Stock: internal locations whose parent is a view
  • +
  • Other: any other location
  • +
+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

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

+
    +
  • BCIM
  • +
  • Okia
  • +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Camptocamp
  • +
+
+
+

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.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_location_zone/tests/__init__.py b/stock_location_zone/tests/__init__.py new file mode 100644 index 000000000..eea57615b --- /dev/null +++ b/stock_location_zone/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_location_zone diff --git a/stock_location_zone/tests/test_stock_location_zone.py b/stock_location_zone/tests/test_stock_location_zone.py new file mode 100644 index 000000000..f18159ac3 --- /dev/null +++ b/stock_location_zone/tests/test_stock_location_zone.py @@ -0,0 +1,62 @@ +# Copyright 2022 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestStockLocationZone(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.location_obj = cls.env["stock.location"] + # Create the following structure: + # # [Zone Location] + # # # [Area Location] + # # # # [Bin Location] + cls.location_zone = cls.location_obj.create( + { + "name": "Zone Location", + "is_zone": True, + } + ) + cls.location_area = cls.location_obj.create( + {"name": "Area Location", "location_id": cls.location_zone.id} + ) + cls.location_bin = cls.location_obj.create( + {"name": "Bin Location", "location_id": cls.location_area.id} + ) + cls.scrap_location = cls.location_obj.create( + { + "name": "Scrap Location", + "usage": "inventory", + } + ) + cls.stock_location = cls.env.ref("stock.warehouse0").lot_stock_id + + def test_location_kind(self): + self.assertEqual("zone", self.location_zone.location_kind) + self.assertEqual("area", self.location_area.location_kind) + self.assertEqual("bin", self.location_bin.location_kind) + self.assertEqual("stock", self.stock_location.location_kind) + self.assertEqual("other", self.scrap_location.location_kind) + + def test_location_zone(self): + # Check that Zone Location has: + # # The zone location as self + # # No area location + self.assertEqual( + self.location_zone.zone_location_id, + self.location_zone, + ) + self.assertFalse(self.location_zone.area_location_id) + # Check that Area Location has: + # # The zone location is Zone Location + # # The area location is self + self.assertEqual(self.location_zone, self.location_area.zone_location_id) + self.assertEqual(self.location_area, self.location_area.area_location_id) + # Check the Bin Location + # # The zone location is Zone Location + # # The area location is Area Location + self.assertEqual(self.location_zone, self.location_bin.zone_location_id) + self.assertEqual(self.location_area, self.location_bin.area_location_id) diff --git a/stock_location_zone/views/stock_location.xml b/stock_location_zone/views/stock_location.xml new file mode 100644 index 000000000..e9d9439f3 --- /dev/null +++ b/stock_location_zone/views/stock_location.xml @@ -0,0 +1,51 @@ + + + + stock.location.zone + stock.location + + + + + + + + + + + + + + view.location.search.inherit + stock.location + + + + + + + + + + + + + + + +