diff --git a/setup/stock_release_channel_split_picking/odoo/addons/stock_release_channel_split_picking b/setup/stock_release_channel_split_picking/odoo/addons/stock_release_channel_split_picking new file mode 120000 index 0000000000..f5b9cbc3bc --- /dev/null +++ b/setup/stock_release_channel_split_picking/odoo/addons/stock_release_channel_split_picking @@ -0,0 +1 @@ +../../../../stock_release_channel_split_picking \ No newline at end of file diff --git a/setup/stock_release_channel_split_picking/setup.py b/setup/stock_release_channel_split_picking/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/stock_release_channel_split_picking/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_release_channel_split_picking/README.rst b/stock_release_channel_split_picking/README.rst new file mode 100644 index 0000000000..071e0686dc --- /dev/null +++ b/stock_release_channel_split_picking/README.rst @@ -0,0 +1,94 @@ +======================================== +Stock Split Picking With Release Channel +======================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6adc05fb392213138501e14646970d7a7e96f8584fce58102abefeeabdb7eeb6 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/stock_release_channel_split_picking + :alt: OCA/wms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_release_channel_split_picking + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is a glue module that integrates the +**stock_release_channel** module with the **stock_picking_split** +module. It ensures that when a stock picking is split, the new picking +is linked to the same release channel as the original picking. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +When the user or the system split a stock picking, the system will +create a new stock picking. If this process occurs while the picking is +linked to a release channel, you expect the new picking to be linked to +the same release channel as the original picking. + +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 + +Contributors +------------ + +- Laurent Mignon laurent.mignon@acsone.eu (https://www.acsone.eu) + +Other credits +------------- + +The development of this module has been financially supported by: + +- Alcyon Benelux + +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_release_channel_split_picking/__init__.py b/stock_release_channel_split_picking/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/stock_release_channel_split_picking/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_release_channel_split_picking/__manifest__.py b/stock_release_channel_split_picking/__manifest__.py new file mode 100644 index 0000000000..17b5b21b0c --- /dev/null +++ b/stock_release_channel_split_picking/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Split Picking With Release Channel", + "summary": """Glue module to preserve the release channel on picking split""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/wms", + "depends": [ + "stock_release_channel", + "stock_split_picking", + ], + "data": [], + "demo": [], + "installable": True, + "auto_install": True, +} diff --git a/stock_release_channel_split_picking/models/__init__.py b/stock_release_channel_split_picking/models/__init__.py new file mode 100644 index 0000000000..ae4c27227f --- /dev/null +++ b/stock_release_channel_split_picking/models/__init__.py @@ -0,0 +1 @@ +from . import stock_picking diff --git a/stock_release_channel_split_picking/models/stock_picking.py b/stock_release_channel_split_picking/models/stock_picking.py new file mode 100644 index 0000000000..c2af53ec56 --- /dev/null +++ b/stock_release_channel_split_picking/models/stock_picking.py @@ -0,0 +1,13 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + def _create_split_backorder(self, default=None): + default = default or {} + default = {**default, "release_channel_id": self.release_channel_id.id} + return super()._create_split_backorder(default=default) diff --git a/stock_release_channel_split_picking/readme/CONTEXT.md b/stock_release_channel_split_picking/readme/CONTEXT.md new file mode 100644 index 0000000000..b8d40badeb --- /dev/null +++ b/stock_release_channel_split_picking/readme/CONTEXT.md @@ -0,0 +1 @@ +When the user or the system split a stock picking, the system will create a new stock picking. If this process occurs while the picking is linked to a release channel, you expect the new picking to be linked to the same release channel as the original picking. \ No newline at end of file diff --git a/stock_release_channel_split_picking/readme/CONTRIBUTORS.md b/stock_release_channel_split_picking/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..a15e3ef244 --- /dev/null +++ b/stock_release_channel_split_picking/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Laurent Mignon (https://www.acsone.eu) diff --git a/stock_release_channel_split_picking/readme/CREDITS.md b/stock_release_channel_split_picking/readme/CREDITS.md new file mode 100644 index 0000000000..f528d1d2eb --- /dev/null +++ b/stock_release_channel_split_picking/readme/CREDITS.md @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Alcyon Benelux diff --git a/stock_release_channel_split_picking/readme/DESCRIPTION.md b/stock_release_channel_split_picking/readme/DESCRIPTION.md new file mode 100644 index 0000000000..f76089b051 --- /dev/null +++ b/stock_release_channel_split_picking/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module is a glue module that integrates the ***stock_release_channel*** module with the ***stock_picking_split*** module. It ensures that when a stock picking is split, the new picking is linked to the same release channel as the original picking. diff --git a/stock_release_channel_split_picking/static/description/icon.png b/stock_release_channel_split_picking/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/stock_release_channel_split_picking/static/description/icon.png differ diff --git a/stock_release_channel_split_picking/static/description/index.html b/stock_release_channel_split_picking/static/description/index.html new file mode 100644 index 0000000000..fea8f4e66f --- /dev/null +++ b/stock_release_channel_split_picking/static/description/index.html @@ -0,0 +1,442 @@ + + + + + +Stock Split Picking With Release Channel + + + +
+

Stock Split Picking With Release Channel

+ + +

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

+

This module is a glue module that integrates the +stock_release_channel module with the stock_picking_split +module. It ensures that when a stock picking is split, the new picking +is linked to the same release channel as the original picking.

+

Table of contents

+ +
+

Use Cases / Context

+

When the user or the system split a stock picking, the system will +create a new stock picking. If this process occurs while the picking is +linked to a release channel, you expect the new picking to be linked to +the same release channel as the original picking.

+
+
+

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

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Alcyon Benelux
  • +
+
+
+

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_release_channel_split_picking/tests/__init__.py b/stock_release_channel_split_picking/tests/__init__.py new file mode 100644 index 0000000000..ba1ec374c9 --- /dev/null +++ b/stock_release_channel_split_picking/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_split_picking diff --git a/stock_release_channel_split_picking/tests/test_stock_split_picking.py b/stock_release_channel_split_picking/tests/test_stock_split_picking.py new file mode 100644 index 0000000000..cdc2999819 --- /dev/null +++ b/stock_release_channel_split_picking/tests/test_stock_split_picking.py @@ -0,0 +1,64 @@ +# Copyright 2017 Tecnativa - Vicent Cubells +# Copyright 2018 Camptocamp SA - Julien Coux +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + +from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT + + +class TestStockSplitPicking(TransactionCase): + @classmethod + def setUpClass(cls): + super(TestStockSplitPicking, cls).setUpClass() + cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) + + cls.src_location = cls.env.ref("stock.stock_location_stock") + cls.dest_location = cls.env.ref("stock.stock_location_customers") + cls.product = cls.env["product.product"].create({"name": "Test product"}) + cls.product_2 = cls.env["product.product"].create({"name": "Test product 2"}) + cls.partner = cls.env["res.partner"].create({"name": "Test partner"}) + + cls.default_channel = cls.env.ref( + "stock_release_channel.stock_release_channel_default" + ) + + cls.picking = cls.env["stock.picking"].create( + { + "partner_id": cls.partner.id, + "picking_type_id": cls.env.ref("stock.picking_type_out").id, + "location_id": cls.src_location.id, + "location_dest_id": cls.dest_location.id, + "release_channel_id": cls.default_channel.id, + } + ) + + def _create_stock_move(product): + return cls.env["stock.move"].create( + { + "name": "/", + "picking_id": cls.picking.id, + "product_id": product.id, + "product_uom_qty": 10, + "product_uom": product.uom_id.id, + "location_id": cls.src_location.id, + "location_dest_id": cls.dest_location.id, + } + ) + + cls.move = _create_stock_move(cls.product) + cls.move_2 = _create_stock_move(cls.product_2) + + def test_stock_split_picking_with_release_channel(self): + wizard = ( + self.env["stock.split.picking"] + .with_context(active_ids=self.picking.ids) + .create({"mode": "move"}) + ) + wizard.action_apply() + self.assertNotEqual(self.move_2.picking_id, self.picking) + self.assertEqual(self.move.picking_id, self.picking) + self.assertEqual( + self.move_2.picking_id.release_channel_id, self.default_channel + ) + self.assertEqual(self.move.picking_id.release_channel_id, self.default_channel)