diff --git a/stock_available_to_promise_release_exclude_location/README.rst b/stock_available_to_promise_release_exclude_location/README.rst new file mode 100644 index 00000000000..edc95f43903 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/README.rst @@ -0,0 +1,75 @@ +=================================================== +Stock Available To Promise Release Exclude Location +=================================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9be7c5317685ddbd2b2c267edc6e33d67c2cfd00031e433138bdb307f346aa68 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github + :target: https://github.com/OCA/wms/tree/18.0/stock_available_to_promise_release_exclude_location + :alt: OCA/wms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/wms-18-0/wms-18-0-stock_available_to_promise_release_exclude_location + :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/wms&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Exclude locations from available stock. + +This module allows to make the glue between +stock_available_to_promise_release and stock_available_exclude_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 +------- + +* ACSONE SA/NV +* BCIM + +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/wms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_available_to_promise_release_exclude_location/__init__.py b/stock_available_to_promise_release_exclude_location/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_available_to_promise_release_exclude_location/__manifest__.py b/stock_available_to_promise_release_exclude_location/__manifest__.py new file mode 100644 index 00000000000..c4b66c62e3d --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2024 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Available To Promise Release Exclude Location", + "summary": "Exclude locations from available stock", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV, BCIM, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/wms", + "depends": [ + "stock_available_to_promise_release", + "stock_available_immediately_exclude_location", + ], + "installable": True, + "auto_install": True, + "application": False, +} diff --git a/stock_available_to_promise_release_exclude_location/i18n/it.po b/stock_available_to_promise_release_exclude_location/i18n/it.po new file mode 100644 index 00000000000..b5ecc99e0d0 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/i18n/it.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_available_to_promise_release_exclude_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-04-16 15:42+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_available_to_promise_release_exclude_location +#: model:ir.model,name:stock_available_to_promise_release_exclude_location.model_stock_location +msgid "Inventory Locations" +msgstr "Ubicazioni di inventario" diff --git a/stock_available_to_promise_release_exclude_location/i18n/stock_available_to_promise_release_exclude_location.pot b/stock_available_to_promise_release_exclude_location/i18n/stock_available_to_promise_release_exclude_location.pot new file mode 100644 index 00000000000..4bbc65cbc48 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/i18n/stock_available_to_promise_release_exclude_location.pot @@ -0,0 +1,19 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_available_to_promise_release_exclude_location +# +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_available_to_promise_release_exclude_location +#: model:ir.model,name:stock_available_to_promise_release_exclude_location.model_stock_location +msgid "Inventory Locations" +msgstr "" diff --git a/stock_available_to_promise_release_exclude_location/models/__init__.py b/stock_available_to_promise_release_exclude_location/models/__init__.py new file mode 100644 index 00000000000..88493e35d94 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/models/__init__.py @@ -0,0 +1 @@ +from . import stock_location diff --git a/stock_available_to_promise_release_exclude_location/models/stock_location.py b/stock_available_to_promise_release_exclude_location/models/stock_location.py new file mode 100644 index 00000000000..08a5f766aca --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/models/stock_location.py @@ -0,0 +1,17 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2024 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models +from odoo.osv import expression + + +class StockLocation(models.Model): + _inherit = "stock.location" + + def _get_available_to_promise_domain(self): + domain = super()._get_available_to_promise_domain() + domain = expression.AND( + [domain, [("location_id.exclude_from_immediately_usable_qty", "=", False)]] + ) + return domain diff --git a/stock_available_to_promise_release_exclude_location/pyproject.toml b/stock_available_to_promise_release_exclude_location/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_available_to_promise_release_exclude_location/readme/DESCRIPTION.md b/stock_available_to_promise_release_exclude_location/readme/DESCRIPTION.md new file mode 100644 index 00000000000..1e9e4b291ee --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +Exclude locations from available stock. + +This module allows to make the glue between +stock_available_to_promise_release and stock_available_exclude_location diff --git a/stock_available_to_promise_release_exclude_location/static/description/icon.png b/stock_available_to_promise_release_exclude_location/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/stock_available_to_promise_release_exclude_location/static/description/icon.png differ diff --git a/stock_available_to_promise_release_exclude_location/static/description/index.html b/stock_available_to_promise_release_exclude_location/static/description/index.html new file mode 100644 index 00000000000..d9613c425ac --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/static/description/index.html @@ -0,0 +1,419 @@ + + + + + +Stock Available To Promise Release Exclude Location + + + +
+

Stock Available To Promise Release Exclude Location

+ + +

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

+

Exclude locations from available stock.

+

This module allows to make the glue between +stock_available_to_promise_release and stock_available_exclude_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

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

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/wms project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_available_to_promise_release_exclude_location/tests/__init__.py b/stock_available_to_promise_release_exclude_location/tests/__init__.py new file mode 100644 index 00000000000..d0e460e00e2 --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/tests/__init__.py @@ -0,0 +1 @@ +from . import test_exclude_location diff --git a/stock_available_to_promise_release_exclude_location/tests/test_exclude_location.py b/stock_available_to_promise_release_exclude_location/tests/test_exclude_location.py new file mode 100644 index 00000000000..4274cda356f --- /dev/null +++ b/stock_available_to_promise_release_exclude_location/tests/test_exclude_location.py @@ -0,0 +1,43 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from datetime import datetime + +from odoo.addons.stock_available_to_promise_release.tests.common import ( + PromiseReleaseCommonCase, +) + + +class AlcPromiseReleaseImmediatelyExcludeTest(PromiseReleaseCommonCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.shipping = cls._out_picking( + cls._create_picking_chain( + cls.wh, [(cls.product1, 5)], date=datetime(2019, 9, 2, 16, 0) + ) + ) + cls.loc_bin1.exclude_from_immediately_usable_qty = True + cls._update_qty_in_location(cls.loc_bin1, cls.product1, 15.0) + cls.wh.delivery_route_id.write( + { + "available_to_promise_defer_pull": True, + "no_backorder_at_release": True, + } + ) + + cls.shipping.release_available_to_promise() + cls.picking = cls._prev_picking(cls.shipping) + cls.picking.action_assign() + + def test_unrelease_full(self): + """Try to unrelease the shipping move. + + As the bin location is marked as + to exclude from immediately available, new picking should not be generated. + """ + self.shipping.move_ids.unrelease() + + # I can release again the move and a new pick is created + self.shipping.release_available_to_promise() + new_picking = self._prev_picking(self.shipping) - self.picking + self.assertFalse(new_picking)