diff --git a/setup/stock_warehouse_orderpoint_stock_info_unreserved/odoo/addons/stock_warehouse_orderpoint_stock_info_unreserved b/setup/stock_warehouse_orderpoint_stock_info_unreserved/odoo/addons/stock_warehouse_orderpoint_stock_info_unreserved new file mode 120000 index 000000000000..54e179f12831 --- /dev/null +++ b/setup/stock_warehouse_orderpoint_stock_info_unreserved/odoo/addons/stock_warehouse_orderpoint_stock_info_unreserved @@ -0,0 +1 @@ +../../../../stock_warehouse_orderpoint_stock_info_unreserved \ No newline at end of file diff --git a/setup/stock_warehouse_orderpoint_stock_info_unreserved/setup.py b/setup/stock_warehouse_orderpoint_stock_info_unreserved/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/stock_warehouse_orderpoint_stock_info_unreserved/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/README.rst b/stock_warehouse_orderpoint_stock_info_unreserved/README.rst new file mode 100644 index 000000000000..11f14d0909b8 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/README.rst @@ -0,0 +1,78 @@ +================================================ +Stock Warehouse Orderpoint Stock Info Unreserved +================================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:30f6ea1cb465372058fc8933af3bce3887d23e39f4de32664bebe0182e7d2331 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/13.0/stock_warehouse_orderpoint_stock_info_unreserved + :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_warehouse_orderpoint_stock_info_unreserved + :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=13.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This modules allows to display the availability of stock on hand and unreserved on a reordering rule. + +**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 +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester Alomar +* Saran Limpajitkutaporn +* Pimolnat Suntian + +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_warehouse_orderpoint_stock_info_unreserved/__init__.py b/stock_warehouse_orderpoint_stock_info_unreserved/__init__.py new file mode 100644 index 000000000000..b9a33ac1e559 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py b/stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py new file mode 100644 index 000000000000..502b89759be2 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Warehouse Orderpoint Stock Info Unreserved", + "version": "14.0.1.0.0", + "depends": ["stock_warehouse_orderpoint_stock_info", "stock_available_unreserved"], + "author": "ForgeFlow, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Warehouse", + "license": "AGPL-3", + "data": ["views/stock_warehouse_orderpoint_view.xml"], + "installable": True, +} diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/de.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/de.po new file mode 100644 index 000000000000..9c41c7d6a9f6 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/de.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +# Translators: +# OCA Transbot , 2017 +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-29 13:13+0000\n" +"PO-Revision-Date: 2017-06-29 13:13+0000\n" +"Last-Translator: Rudolf Schnapka , 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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Mindestbestandsregel" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "Bestand am Lagerplatz (nicht reserviert)" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es.po new file mode 100644 index 000000000000..64bed5d85318 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 05:36+0000\n" +"PO-Revision-Date: 2017-06-10 05:36+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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Regla de inventario mínimo" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es_ES.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es_ES.po new file mode 100644 index 000000000000..5bad1e23fbe0 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/es_ES.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +# Translators: +# Daniel , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-26 11:42+0000\n" +"PO-Revision-Date: 2017-07-26 11:42+0000\n" +"Last-Translator: Daniel , 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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Regla inventario mínimo" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/pt_BR.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/pt_BR.po new file mode 100644 index 000000000000..ee4d7fbe1d59 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/pt_BR.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 05:36+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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Regra minima de inventário" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "Quantidade no local (não reservada)" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/sl.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/sl.po new file mode 100644 index 000000000000..8cf04bc4a554 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/sl.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-10 05:36+0000\n" +"PO-Revision-Date: 2017-06-10 05:36+0000\n" +"Last-Translator: OCA Transbot , 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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "Pravilo minimalne zaloge" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/stock_warehouse_orderpoint_stock_info_unreserved.pot b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/stock_warehouse_orderpoint_stock_info_unreserved.pot new file mode 100644 index 000000000000..596df151f414 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/stock_warehouse_orderpoint_stock_info_unreserved.pot @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/i18n/zh_CN.po b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/zh_CN.po new file mode 100644 index 000000000000..4a059aab5141 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/i18n/zh_CN.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_warehouse_orderpoint_stock_info_unreserved +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-10-16 15:58+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_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model,name:stock_warehouse_orderpoint_stock_info_unreserved.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "最小库存规则" + +#. module: stock_warehouse_orderpoint_stock_info_unreserved +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint__product_location_qty_available_not_res +#: model:ir.model.fields,field_description:stock_warehouse_orderpoint_stock_info_unreserved.field_stock_warehouse_orderpoint_template__product_location_qty_available_not_res +msgid "Quantity On Location (Unreserved)" +msgstr "位置数量(未预留)" diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/models/__init__.py b/stock_warehouse_orderpoint_stock_info_unreserved/models/__init__.py new file mode 100644 index 000000000000..0561cac48db8 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import stock_warehouse_orderpoint diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py new file mode 100644 index 000000000000..dc09bc31c067 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/models/stock_warehouse_orderpoint.py @@ -0,0 +1,34 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from collections import defaultdict + +from odoo import fields, models + + +class StockWarehouseOrderpoint(models.Model): + _inherit = "stock.warehouse.orderpoint" + + product_location_qty_available_not_res = fields.Float( + string="Quantity On Location (Unreserved)", + compute="_compute_product_available_qty", + ) + + def _compute_product_available_qty(self): + super()._compute_product_available_qty() + op_by_loc = defaultdict(set) + for order in self: + op_by_loc[order.location_id].add(order.id) + for location_id, order_in_loc in op_by_loc.items(): + order_in_loc = self.browse(order_in_loc) + products = ( + order_in_loc.mapped("product_id") + .with_context(location=location_id.id) + ._compute_qty_available_not_reserved() + ) + for order in order_in_loc: + product = products[order.product_id.id] + order.product_location_qty_available_not_res = product[ + "qty_available_not_res" + ] diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/readme/CONTRIBUTORS.rst b/stock_warehouse_orderpoint_stock_info_unreserved/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..e7321aef17f6 --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Jordi Ballester Alomar +* Saran Limpajitkutaporn +* Pimolnat Suntian diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/readme/DESCRIPTION.rst b/stock_warehouse_orderpoint_stock_info_unreserved/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..bf19c52bf93e --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This modules allows to display the availability of stock on hand and unreserved on a reordering rule. diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/icon.png differ diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/static/description/index.html b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/index.html new file mode 100644 index 000000000000..4e6a0b48ba7b --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +Stock Warehouse Orderpoint Stock Info Unreserved + + + +
+

Stock Warehouse Orderpoint Stock Info Unreserved

+ + +

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

+

This modules allows to display the availability of stock on hand and unreserved on a reordering rule.

+

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

+
    +
  • ForgeFlow
  • +
+
+
+

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_warehouse_orderpoint_stock_info_unreserved/tests/__init__.py b/stock_warehouse_orderpoint_stock_info_unreserved/tests/__init__.py new file mode 100644 index 000000000000..7bb2afa2d7ed --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/tests/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_stock_warehouse_orderpoint diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py new file mode 100644 index 000000000000..00ad2d55fcea --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/tests/test_stock_warehouse_orderpoint.py @@ -0,0 +1,124 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2016 ForgeFlow, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestStockWarehouseOrderpoint(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + # Get required Model + cls.reordering_rule_model = cls.env["stock.warehouse.orderpoint"] + cls.stock_move_model = cls.env["stock.move"] + cls.product_model = cls.env["product.product"] + cls.product_ctg_model = cls.env["product.category"] + + # Get required Model data + cls.product_uom = cls.env.ref("uom.product_uom_unit") + cls.location_stock = cls.env.ref("stock.stock_location_stock") + cls.location_shelf1 = cls.env.ref("stock.stock_location_components") + cls.location_customer = cls.env.ref("stock.stock_location_customers") + cls.location_supplier = cls.env.ref("stock.stock_location_suppliers") + + # Create product category and product + cls.product_ctg = cls._create_product_category() + cls.product = cls._create_product() + + # Create Reordering Rule + cls.reordering_record = cls.create_orderpoint() + + @classmethod + def _create_product_category(cls): + """Create a Product Category.""" + product_ctg = cls.product_ctg_model.create({"name": "test_product_ctg"}) + return product_ctg + + @classmethod + def _create_product(cls): + """Create a Stockable Product.""" + product = cls.product_model.create( + { + "name": "Test Product", + "categ_id": cls.product_ctg.id, + "type": "product", + "uom_id": cls.product_uom.id, + } + ) + return product + + @classmethod + def create_orderpoint(cls): + """Create a Reordering rule for the product.""" + record = cls.reordering_rule_model.create( + { + "name": "Reordering Rule", + "product_id": cls.product.id, + "product_min_qty": "1", + "product_max_qty": "5", + "qty_multiple": "1", + "location_id": cls.location_stock.id, + } + ) + return record + + def create_move(self, source_location, destination_location): + move = self.env["stock.move"].create( + { + "name": "Test move", + "product_id": self.product.id, + "product_uom": self.product_uom.id, + "product_uom_qty": 10, + "quantity_done": 10, + "location_id": source_location.id, + "location_dest_id": destination_location.id, + } + ) + + move._action_confirm() + return move + + def test_product_qty(self): + """Tests the product quantity in the Reordering rules""" + # Create & process moves to test the product quantity + move_in = self.create_move(self.location_supplier, self.location_stock) + move_out = self.create_move(self.location_stock, self.location_customer) + self.reordering_record.refresh() + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + 0.0, + "Quantity On Hand (Unreserved) does not match", + ) + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + self.product.qty_available_not_res, + "Quantity On Hand (Unreserved) in the orderpoint " + "does not match with the product.", + ) + move_in._action_done() + self.reordering_record.refresh() + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + 10.0, + "Quantity On Hand (Unreserved) does not match", + ) + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + self.product.qty_available_not_res, + "Quantity On Hand (Unreserved) in the orderpoint " + "does not match with the product.", + ) + move_out._action_done() + self.reordering_record.refresh() + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + 0.0, + "Quantity On Hand (Unreserved) does not match", + ) + self.assertEqual( + self.reordering_record.product_location_qty_available_not_res, + self.product.qty_available_not_res, + "Quantity On Hand (Unreserved) in the orderpoint " + "does not match with the product.", + ) diff --git a/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml b/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml new file mode 100644 index 000000000000..e677204728be --- /dev/null +++ b/stock_warehouse_orderpoint_stock_info_unreserved/views/stock_warehouse_orderpoint_view.xml @@ -0,0 +1,29 @@ + + + + stock.warehouse.orderpoint.tree + stock.warehouse.orderpoint + + + + + + + + + stock.warehouse.orderpoint.form + stock.warehouse.orderpoint + + + + + + + + diff --git a/test-requirements.txt b/test-requirements.txt index 66bc2cbae3f9..1d857fcf3e1e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,2 @@ odoo_test_helper +odoo14-addon-stock_warehouse_orderpoint_stock_info@git+https://github.com/OCA/stock-logistics-warehouse@refs/pull/1850/head#subdirectory=setup/stock_warehouse_orderpoint_stock_info