diff --git a/stock_inventory_exclude_sublocation/README.rst b/stock_inventory_exclude_sublocation/README.rst new file mode 100644 index 000000000..e5e27393c --- /dev/null +++ b/stock_inventory_exclude_sublocation/README.rst @@ -0,0 +1,93 @@ +=================================== +Stock Inventory Exclude Sublocation +=================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png + :target: https://odoo-community.org/page/development-status + :alt: Mature +.. |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/13.0/stock_inventory_exclude_sublocation + :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-13-0/stock-logistics-warehouse-13-0-stock_inventory_exclude_sublocation + :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/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of Inventory Adjustment to allow you to +exclude all the sublocations when doing an inventory adjustment for a +given location. + +Sometimes we just want to make an inventory adjustment of just one shelf, or +space and forget about extra subdivisions in the location. In other cases we +do inventories of smaller locations contained in our stock, so we don't want +to count them again when doing an inventory adjustment of the parent location. +E.g. if we apply a cycle count strategy. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you simply need to: + +#. Create a new inventory adjustment. +#. Select the option inventory of all products. +#. Check the box "Exclude Sublocations". + +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 +~~~~~~~ + +* Eficent +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Lois Rilo Antelo +* Bhavesh Odedra +* Héctor Villarreal + +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_inventory_exclude_sublocation/__init__.py b/stock_inventory_exclude_sublocation/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_inventory_exclude_sublocation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_inventory_exclude_sublocation/__manifest__.py b/stock_inventory_exclude_sublocation/__manifest__.py new file mode 100644 index 000000000..5490a3b12 --- /dev/null +++ b/stock_inventory_exclude_sublocation/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2017-2019 ForgeFlow S.L. (http://www.forgeflow.com) +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Stock Inventory Exclude Sublocation", + "summary": "Allow to perform inventories of a location without including " + "its child locations.", + "version": "13.0.1.0.1", + "development_status": "Mature", + "author": "ForgeFlow, Tecnativa, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Warehouse", + "depends": ["stock"], + "data": ["views/stock_inventory_view.xml"], + "license": "AGPL-3", + "installable": True, + "application": False, +} diff --git a/stock_inventory_exclude_sublocation/i18n/cs_CZ.po b/stock_inventory_exclude_sublocation/i18n/cs_CZ.po new file mode 100644 index 000000000..77850e47e --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/cs_CZ.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "Vyloučení sublocací" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventář" diff --git a/stock_inventory_exclude_sublocation/i18n/de.po b/stock_inventory_exclude_sublocation/i18n/de.po new file mode 100644 index 000000000..42926b5e7 --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/de.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:53+0000\n" +"PO-Revision-Date: 2017-11-30 03:53+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\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" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Bestand" diff --git a/stock_inventory_exclude_sublocation/i18n/es.po b/stock_inventory_exclude_sublocation/i18n/es.po new file mode 100644 index 000000000..3c756c34f --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/es.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-30 03:53+0000\n" +"PO-Revision-Date: 2017-11-30 03:53+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventario" diff --git a/stock_inventory_exclude_sublocation/i18n/es_ES.po b/stock_inventory_exclude_sublocation/i18n/es_ES.po new file mode 100644 index 000000000..112291aa2 --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/es_ES.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# Javier García-Panach , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-10 03:40+0000\n" +"PO-Revision-Date: 2017-02-10 03:40+0000\n" +"Last-Translator: Javier García-Panach , 2017\n" +"Language-Team: Spanish (Spain) (https://www.transifex.com/oca/teams/23907/" +"es_ES/)\n" +"Language: es_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" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventario" diff --git a/stock_inventory_exclude_sublocation/i18n/fr.po b/stock_inventory_exclude_sublocation/i18n/fr.po new file mode 100644 index 000000000..4e811a9da --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/fr.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-10 03:40+0000\n" +"PO-Revision-Date: 2017-02-10 03:40+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\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" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventaire" diff --git a/stock_inventory_exclude_sublocation/i18n/it.po b/stock_inventory_exclude_sublocation/i18n/it.po new file mode 100644 index 000000000..3c96edca6 --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/it.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# Paolo Valier , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-10 03:40+0000\n" +"PO-Revision-Date: 2017-02-10 03:40+0000\n" +"Last-Translator: Paolo Valier , 2017\n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\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" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventario" diff --git a/stock_inventory_exclude_sublocation/i18n/pt_BR.po b/stock_inventory_exclude_sublocation/i18n/pt_BR.po new file mode 100644 index 000000000..1b36a670e --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/pt_BR.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# Felipe Lopes , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-10 03:40+0000\n" +"PO-Revision-Date: 2019-08-30 14:23+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" +"23907/pt_BR/)\n" +"Language: pt_BR\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 3.8\n" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "Excluir Sublocações" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventário" diff --git a/stock_inventory_exclude_sublocation/i18n/sl.po b/stock_inventory_exclude_sublocation/i18n/sl.po new file mode 100644 index 000000000..b8978513a --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/sl.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +# Translators: +# Matjaž Mozetič , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-10 03:40+0000\n" +"PO-Revision-Date: 2017-02-10 03:40+0000\n" +"Last-Translator: Matjaž Mozetič , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "Inventar" diff --git a/stock_inventory_exclude_sublocation/i18n/stock_inventory_exclude_sublocation.pot b/stock_inventory_exclude_sublocation/i18n/stock_inventory_exclude_sublocation.pot new file mode 100644 index 000000000..a7da76319 --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/stock_inventory_exclude_sublocation.pot @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "" + diff --git a/stock_inventory_exclude_sublocation/i18n/zh_CN.po b/stock_inventory_exclude_sublocation/i18n/zh_CN.po new file mode 100644 index 000000000..96ca4c085 --- /dev/null +++ b/stock_inventory_exclude_sublocation/i18n/zh_CN.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_inventory_exclude_sublocation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-28 09:24+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_inventory_exclude_sublocation +#: model:ir.model.fields,field_description:stock_inventory_exclude_sublocation.field_stock_inventory__exclude_sublocation +msgid "Exclude Sublocations" +msgstr "排除子位置" + +#. module: stock_inventory_exclude_sublocation +#: model:ir.model,name:stock_inventory_exclude_sublocation.model_stock_inventory +msgid "Inventory" +msgstr "库存" diff --git a/stock_inventory_exclude_sublocation/models/__init__.py b/stock_inventory_exclude_sublocation/models/__init__.py new file mode 100644 index 000000000..35536816e --- /dev/null +++ b/stock_inventory_exclude_sublocation/models/__init__.py @@ -0,0 +1 @@ +from . import stock_inventory diff --git a/stock_inventory_exclude_sublocation/models/stock_inventory.py b/stock_inventory_exclude_sublocation/models/stock_inventory.py new file mode 100644 index 000000000..708637769 --- /dev/null +++ b/stock_inventory_exclude_sublocation/models/stock_inventory.py @@ -0,0 +1,32 @@ +# Copyright 2019 ForgeFlow S.L. (http://www.forgeflow.com) +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class Inventory(models.Model): + _inherit = "stock.inventory" + + exclude_sublocation = fields.Boolean( + string="Exclude Sublocations", + default=False, + track_visibility="onchange", + readonly=True, + states={"draft": [("readonly", False)]}, + ) + + def _get_inventory_lines_values(self): + """Discard inventory lines that are from sublocations if option + is enabled. + + Done this way for maximizing inheritance compatibility. + """ + vals = super()._get_inventory_lines_values() + if not self.exclude_sublocation: + return vals + new_vals = [] + for val in vals: + if val["location_id"] in self.location_ids.ids: + new_vals.append(val) + return new_vals diff --git a/stock_inventory_exclude_sublocation/readme/CONTRIBUTORS.rst b/stock_inventory_exclude_sublocation/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..e3a64aee6 --- /dev/null +++ b/stock_inventory_exclude_sublocation/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Lois Rilo Antelo +* Bhavesh Odedra +* Héctor Villarreal diff --git a/stock_inventory_exclude_sublocation/readme/DESCRIPTION.rst b/stock_inventory_exclude_sublocation/readme/DESCRIPTION.rst new file mode 100644 index 000000000..1175e27f7 --- /dev/null +++ b/stock_inventory_exclude_sublocation/readme/DESCRIPTION.rst @@ -0,0 +1,9 @@ +This module extends the functionality of Inventory Adjustment to allow you to +exclude all the sublocations when doing an inventory adjustment for a +given location. + +Sometimes we just want to make an inventory adjustment of just one shelf, or +space and forget about extra subdivisions in the location. In other cases we +do inventories of smaller locations contained in our stock, so we don't want +to count them again when doing an inventory adjustment of the parent location. +E.g. if we apply a cycle count strategy. diff --git a/stock_inventory_exclude_sublocation/readme/USAGE.rst b/stock_inventory_exclude_sublocation/readme/USAGE.rst new file mode 100644 index 000000000..b1c26759c --- /dev/null +++ b/stock_inventory_exclude_sublocation/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you simply need to: + +#. Create a new inventory adjustment. +#. Select the option inventory of all products. +#. Check the box "Exclude Sublocations". diff --git a/stock_inventory_exclude_sublocation/static/description/icon.png b/stock_inventory_exclude_sublocation/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_inventory_exclude_sublocation/static/description/icon.png differ diff --git a/stock_inventory_exclude_sublocation/static/description/index.html b/stock_inventory_exclude_sublocation/static/description/index.html new file mode 100644 index 000000000..f9d5ff9ca --- /dev/null +++ b/stock_inventory_exclude_sublocation/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +Stock Inventory Exclude Sublocation + + + +
+

Stock Inventory Exclude Sublocation

+ + +

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

+

This module extends the functionality of Inventory Adjustment to allow you to +exclude all the sublocations when doing an inventory adjustment for a +given location.

+

Sometimes we just want to make an inventory adjustment of just one shelf, or +space and forget about extra subdivisions in the location. In other cases we +do inventories of smaller locations contained in our stock, so we don’t want +to count them again when doing an inventory adjustment of the parent location. +E.g. if we apply a cycle count strategy.

+

Table of contents

+ +
+

Usage

+

To use this module, you simply need to:

+
    +
  1. Create a new inventory adjustment.
  2. +
  3. Select the option inventory of all products.
  4. +
  5. Check the box “Exclude Sublocations”.
  6. +
+
+
+

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

+
    +
  • Eficent
  • +
  • Tecnativa
  • +
+
+
+

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.

+

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_inventory_exclude_sublocation/tests/__init__.py b/stock_inventory_exclude_sublocation/tests/__init__.py new file mode 100644 index 000000000..2d88b76aa --- /dev/null +++ b/stock_inventory_exclude_sublocation/tests/__init__.py @@ -0,0 +1 @@ +from . import test_exclude_sublocation diff --git a/stock_inventory_exclude_sublocation/tests/test_exclude_sublocation.py b/stock_inventory_exclude_sublocation/tests/test_exclude_sublocation.py new file mode 100644 index 000000000..d3e060f24 --- /dev/null +++ b/stock_inventory_exclude_sublocation/tests/test_exclude_sublocation.py @@ -0,0 +1,129 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestStockInventoryExcludeSublocation(TransactionCase): + def setUp(self): + super(TestStockInventoryExcludeSublocation, self).setUp() + self.inventory_model = self.env["stock.inventory"] + self.location_model = self.env["stock.location"] + self.res_users_model = self.env["res.users"] + + self.company = self.env.ref("base.main_company") + self.partner = self.ref("base.res_partner_4") + self.grp_stock_manager = self.env.ref("stock.group_stock_manager") + + self.user = self.res_users_model.create( + { + "name": "Test Account User", + "login": "user_1", + "email": "example@yourcompany.com", + "company_id": self.company.id, + "company_ids": [(4, self.company.id)], + "groups_id": [(6, 0, [self.grp_stock_manager.id])], + } + ) + + self.product1 = self.env["product.product"].create( + { + "name": "Product for parent location", + "type": "product", + "default_code": "PROD1", + } + ) + self.product2 = self.env["product.product"].create( + { + "name": "Product for child location", + "type": "product", + "default_code": "PROD2", + } + ) + self.location = self.location_model.create( + {"name": "Inventory tests", "usage": "internal"} + ) + self.sublocation = self.location_model.create( + { + "name": "Inventory sublocation test", + "usage": "internal", + "location_id": self.location.id, + } + ) + + # Add a product in each location + starting_inv = self.inventory_model.create( + { + "name": "Starting inventory", + "line_ids": [ + ( + 0, + 0, + { + "product_id": self.product1.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_qty": 2.0, + "location_id": self.location.id, + }, + ), + ( + 0, + 0, + { + "product_id": self.product2.id, + "product_uom_id": self.env.ref("uom.product_uom_unit").id, + "product_qty": 4.0, + "location_id": self.sublocation.id, + }, + ), + ], + } + ) + starting_inv.action_start() + starting_inv.action_validate() + + def _create_inventory_all_products(self, name, location, exclude_sublocation): + inventory = self.inventory_model.create( + { + "name": name, + "location_ids": [(4, location.id)], + "exclude_sublocation": exclude_sublocation, + } + ) + return inventory + + def test_not_excluding_sublocations(self): + """Check if products in sublocations are included into the inventory + if the excluding sublocations option is disabled.""" + inventory_location = self._create_inventory_all_products( + "location inventory", self.location, False + ) + inventory_location.action_start() + inventory_location.action_validate() + lines = inventory_location.line_ids + self.assertEqual(len(lines), 2, "Not all expected products are " "included") + + def test_excluding_sublocations(self): + """Check if products in sublocations are not included if the exclude + sublocations is enabled.""" + inventory_location = self._create_inventory_all_products( + "location inventory", self.location, True + ) + inventory_sublocation = self._create_inventory_all_products( + "sublocation inventory", self.sublocation, True + ) + inventory_location.action_start() + inventory_location.action_validate() + inventory_sublocation.action_start() + inventory_sublocation.action_validate() + lines_location = inventory_location.line_ids + lines_sublocation = inventory_sublocation.line_ids + self.assertEqual( + len(lines_location), 1, "The products in the sublocations are not excluded" + ) + self.assertEqual( + len(lines_sublocation), + 1, + "The products in the sublocations are not excluded", + ) diff --git a/stock_inventory_exclude_sublocation/views/stock_inventory_view.xml b/stock_inventory_exclude_sublocation/views/stock_inventory_view.xml new file mode 100644 index 000000000..cb845d0fa --- /dev/null +++ b/stock_inventory_exclude_sublocation/views/stock_inventory_view.xml @@ -0,0 +1,21 @@ + + + + + + + Inventory form view - stock_inventory_exclude_sublocation extension + stock.inventory + + + + + + + + +