diff --git a/stock_location_zone/README.rst b/stock_location_zone/README.rst new file mode 100644 index 000000000000..3c24b005c5ea --- /dev/null +++ b/stock_location_zone/README.rst @@ -0,0 +1,106 @@ +=================== +Stock Location Zone +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bf2eabaeb9af2cc9aaf2723a3e8674c65952fd2dfdf4a69a6e7eb9fc12982502 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/17.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-17-0/stock-logistics-warehouse-17-0-stock_location_zone + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=17.0 + :alt: Try me on Runboat + +|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 + +**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 to smash 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 +- Denis Roussel +- Murtaza Mithaiwala <> + +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 000000000000..0650744f6bc6 --- /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 000000000000..bde6a57d36f2 --- /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": "17.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/es.po b/stock_location_zone/i18n/es.po new file mode 100644 index 000000000000..65d675618c27 --- /dev/null +++ b/stock_location_zone/i18n/es.po @@ -0,0 +1,102 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_zone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-27 23:12+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__area +msgid "Area" +msgstr "Área" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Area location" +msgstr "Localización del área" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__bin +msgid "Bin" +msgstr "Contenedor" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Group By" +msgstr "Agrupado por" + +#. 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 "" +"Agrupe las ubicaciones según su tipo: * Zona: ubicaciones marcadas como " +"zonas * Área: ubicaciones con hijos que forman parte de una zona * Papelera: " +"ubicaciones sin hijos que forman parte de una zona * Existencias: " +"ubicaciones internas cuyo padre es una vista * Otros: cualquier otra " +"ubicación" + +#. module: stock_location_zone +#: model:ir.model,name:stock_location_zone.model_stock_location +msgid "Inventory Locations" +msgstr "Localizaciones de Inventario" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__is_zone +msgid "Is a Zone Location?" +msgstr "¿Es una localización de zona?" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__area_location_id +msgid "Location Area" +msgstr "Área de localización" + +#. 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 "Tipo de ubicación" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__zone_location_id +msgid "Location Zone" +msgstr "Zona de localización" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__stock +msgid "Main Stock" +msgstr "Existencias principales" + +#. 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 "Marca para definir esta localización como zona" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__other +msgid "Other" +msgstr "Otra/o" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__zone +msgid "Zone" +msgstr "Zona" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Zone location" +msgstr "Localización de zona" diff --git a/stock_location_zone/i18n/it.po b/stock_location_zone/i18n/it.po new file mode 100644 index 000000000000..fd33e035f2fb --- /dev/null +++ b/stock_location_zone/i18n/it.po @@ -0,0 +1,101 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_zone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-21 13:33+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__area +msgid "Area" +msgstr "Area" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Area location" +msgstr "Ubicazione area" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__bin +msgid "Bin" +msgstr "Contenitore" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Group By" +msgstr "Raggruppa per" + +#. 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 "" +"Raggruppa ubicazioni in accordo dei loro tipi: * Zona: uticazioni marcate " +"come zone * Area: ubicazioni con figli che sono parte di una zona * " +"Contenitore: ubicazioni senza figli che sono parte di una zona * Magazzino: " +"ubicazioni interne il cui padre è una vista * Altro: altre ubicazioni" + +#. module: stock_location_zone +#: model:ir.model,name:stock_location_zone.model_stock_location +msgid "Inventory Locations" +msgstr "Ubicazioni di inventario" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__is_zone +msgid "Is a Zone Location?" +msgstr "È una ubicazione zona?" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__area_location_id +msgid "Location Area" +msgstr "Area ubicazione" + +#. 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 "Tipo ubicazione" + +#. module: stock_location_zone +#: model:ir.model.fields,field_description:stock_location_zone.field_stock_location__zone_location_id +msgid "Location Zone" +msgstr "Zona ubicazione" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__stock +msgid "Main Stock" +msgstr "Magazzino principale" + +#. 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 "Selezionare per definire questa ubicazione come zona" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__other +msgid "Other" +msgstr "Altro" + +#. module: stock_location_zone +#: model:ir.model.fields.selection,name:stock_location_zone.selection__stock_location__location_kind__zone +msgid "Zone" +msgstr "Zona" + +#. module: stock_location_zone +#: model_terms:ir.ui.view,arch_db:stock_location_zone.view_location_search +msgid "Zone location" +msgstr "Ubicazione zona" 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 000000000000..f103239097a6 --- /dev/null +++ b/stock_location_zone/i18n/stock_location_zone.pot @@ -0,0 +1,94 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_zone +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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_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 +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 +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 000000000000..3dbcf5af2c21 --- /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 000000000000..88493e35d945 --- /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 000000000000..86a05ce9bb8c --- /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/pyproject.toml b/stock_location_zone/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/stock_location_zone/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_location_zone/readme/CONTRIBUTORS.md b/stock_location_zone/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..4f74d866733c --- /dev/null +++ b/stock_location_zone/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ + - Syvain Van Hoof (Okia sprl) \<\> + - Jacques-Etienne Baudoux (BCIM) \<\> + - Guewen Baconnier (Camptocamp) \<\> + - Akim Juillerat \<\> + - Phuc Tran Thanh \<\> + - Denis Roussel \<\> + - Murtaza Mithaiwala \<\> diff --git a/stock_location_zone/readme/CREDITS.md b/stock_location_zone/readme/CREDITS.md new file mode 100644 index 000000000000..08e428ec00f9 --- /dev/null +++ b/stock_location_zone/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + + - Camptocamp diff --git a/stock_location_zone/readme/DESCRIPTION.md b/stock_location_zone/readme/DESCRIPTION.md new file mode 100644 index 000000000000..ae0eb1e9e7ef --- /dev/null +++ b/stock_location_zone/readme/DESCRIPTION.md @@ -0,0 +1,16 @@ +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 000000000000..3a0328b516c4 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 000000000000..640ea1b9aeee --- /dev/null +++ b/stock_location_zone/static/description/index.html @@ -0,0 +1,451 @@ + + + + + +Stock Location Zone + + + +
+

Stock Location Zone

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

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
  • +
+

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 to smash 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 000000000000..eea57615b645 --- /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 000000000000..f18159ac3d3f --- /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 000000000000..e9d9439f3a0b --- /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 + + + + + + + + + + + + + + + +