diff --git a/setup/stock_location_pending_move/odoo/addons/stock_location_pending_move b/setup/stock_location_pending_move/odoo/addons/stock_location_pending_move new file mode 120000 index 000000000..d433e94de --- /dev/null +++ b/setup/stock_location_pending_move/odoo/addons/stock_location_pending_move @@ -0,0 +1 @@ +../../../../stock_location_pending_move \ No newline at end of file diff --git a/setup/stock_location_pending_move/setup.py b/setup/stock_location_pending_move/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_location_pending_move/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_location_pending_move/README.rst b/stock_location_pending_move/README.rst new file mode 100644 index 000000000..0ab15b2af --- /dev/null +++ b/stock_location_pending_move/README.rst @@ -0,0 +1,139 @@ +=========================== +Stock Location Pending Move +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:13932439c6430c16f223accefd5f51924e3f1839546e1d47376881d21d6147d7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/stock_location_pending_move + :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-16-0/stock-logistics-warehouse-16-0-stock_location_pending_move + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to access incoming and ougoing pending moves from a +stock location. + +- Stock Location view: + +|Pending Moves| + +- Detail grouped per origin location: + +|Detailed view| + +.. |Pending Moves| image:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/stock_location_pending_move/static/description/pending_moves.png +.. |Detailed view| image:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/16.0/stock_location_pending_move/static/description/pending_moves_detail.png + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +When user wants to make a diagnostic on a particular stock location, it +is useful to have pending stock moves that will go in or go out (you can +also go to 'Moves History' but you need to use a filter on stock +location). + +Configuration +============= + +[ This file is not always required; it should explain **how to configure +the module before using it**; it is aimed at users with administration +privileges. + +Please be detailed on the path to configuration (eg: do you need to +activate developer mode?), describe step by step configurations and the +use of screenshots is strongly recommended.] + +To configure this module, you need to: + +- Go to *App* > Menu > Menu item +- Activate boolean… > save +- … + +Usage +===== + +- Storage Locations should have been enabled. +- Go to Inventory > Configuration > Warehouse Management > Locations +- Click on 'Pending Move' to see stock moves. +- Click on 'Pending Operations' to see detailed operations. +- By default, the moves are displayed grouped by source location in + order to easy review if there are plenty of moves. + +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 +* Camptocamp + +Contributors +------------ + +- Denis Roussel denis.roussel@acsone.eu +- Guewen Baconnier +- Akim Juillerat akim.juillerat@camptocamp.com +- Alexandre Fayolle alexandre.faoylle@camptocamp.com + +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. + +.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px + :target: https://github.com/rousseldenis + :alt: rousseldenis +.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px + :target: https://github.com/jbaudoux + :alt: jbaudoux + +Current `maintainers `__: + +|maintainer-rousseldenis| |maintainer-jbaudoux| + +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_pending_move/__init__.py b/stock_location_pending_move/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_location_pending_move/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_location_pending_move/__manifest__.py b/stock_location_pending_move/__manifest__.py new file mode 100644 index 000000000..8cc0d3f68 --- /dev/null +++ b/stock_location_pending_move/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock Location Pending Move", + "summary": """ + This module allows to show pending stock moves (outgoing and incoming) + on a stock location""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,BCIM,Camptocamp,Odoo Community Association (OCA)", + "maintainers": ["rousseldenis", "jbaudoux"], + "website": "https://github.com/OCA/stock-logistics-warehouse", + "depends": ["stock"], + "data": ["views/stock_location.xml"], +} diff --git a/stock_location_pending_move/models/__init__.py b/stock_location_pending_move/models/__init__.py new file mode 100644 index 000000000..88493e35d --- /dev/null +++ b/stock_location_pending_move/models/__init__.py @@ -0,0 +1 @@ +from . import stock_location diff --git a/stock_location_pending_move/models/stock_location.py b/stock_location_pending_move/models/stock_location.py new file mode 100644 index 000000000..b1885499a --- /dev/null +++ b/stock_location_pending_move/models/stock_location.py @@ -0,0 +1,106 @@ +# Copyright 2019 Camptocamp SA +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models +from odoo.tools.safe_eval import safe_eval + +PENDING_MOVE_DOMAIN = [ + ("state", "in", ("waiting", "confirmed", "partially_available", "assigned")) +] + + +class StockLocation(models.Model): + + _inherit = "stock.location" + + pending_in_move_ids = fields.One2many( + "stock.move", + "location_dest_id", + domain=PENDING_MOVE_DOMAIN, + help="Technical field: the pending incoming stock moves for the location", + ) + + pending_in_move_line_ids = fields.One2many( + "stock.move.line", + "location_dest_id", + domain=PENDING_MOVE_DOMAIN, + help="Technical field: the pending incoming " + "stock move lines for the location", + ) + pending_out_move_ids = fields.One2many( + "stock.move", + "location_id", + domain=PENDING_MOVE_DOMAIN, + help="Technical field: the pending outgoing stock moves for the location", + ) + pending_out_move_line_ids = fields.One2many( + "stock.move.line", + "location_id", + domain=PENDING_MOVE_DOMAIN, + help="Technical field: the pending outgoing " + "stock move lines for the location", + ) + + def action_show_pending_stock_move_lines(self): + """ + Display all pending stock move lines (outgoing and incoming) + for the location. + """ + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_line_action" + ) + # Remove default searches from stock module + context = action.get("context", "{}") + context_dict = safe_eval(context) + if "search_default_done" in context_dict: + context_dict.pop("search_default_done") + context_dict["search_default_todo"] = "1" + context_dict["search_default_by_location"] = True + action["context"] = str(context_dict) + action.update( + { + "domain": [ + ( + "id", + "in", + (self.pending_out_move_line_ids | self.pending_in_move_line_ids) + .sorted() + .ids, + ) + ], + } + ) + return action + + def action_show_pending_stock_moves(self): + """ + Display all pending stock moves (outgoing and incoming) + for the location. + """ + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_action" + ) + # Remove default searches from stock module + context = action.get("context", "{}") + context_dict = safe_eval(context) + if "search_default_done" in context_dict: + context_dict.pop("search_default_done") + context_dict["search_default_todo"] = "1" + context_dict["search_default_groupby_location_id"] = True + action["context"] = str(context_dict) + action.update( + { + "domain": [ + ( + "id", + "in", + (self.pending_in_move_ids | self.pending_out_move_ids) + .sorted() + .ids, + ) + ], + } + ) + return action diff --git a/stock_location_pending_move/readme/CONFIGURE.md b/stock_location_pending_move/readme/CONFIGURE.md new file mode 100644 index 000000000..2fdb0e64a --- /dev/null +++ b/stock_location_pending_move/readme/CONFIGURE.md @@ -0,0 +1,10 @@ +[ This file is not always required; it should explain **how to configure the module before using it**; it is aimed at users with administration privileges. + +Please be detailed on the path to configuration (eg: do you need to activate developer mode?), describe step by step configurations and the use of screenshots is strongly recommended.] + + +To configure this module, you need to: + +- Go to *App* > Menu > Menu item +- Activate boolean… > save +- … diff --git a/stock_location_pending_move/readme/CONTEXT.md b/stock_location_pending_move/readme/CONTEXT.md new file mode 100644 index 000000000..a812af5d2 --- /dev/null +++ b/stock_location_pending_move/readme/CONTEXT.md @@ -0,0 +1,3 @@ +When user wants to make a diagnostic on a particular stock location, it is +useful to have pending stock moves that will go in or go out (you can also +go to 'Moves History' but you need to use a filter on stock location). diff --git a/stock_location_pending_move/readme/CONTRIBUTORS.md b/stock_location_pending_move/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..cc0cf2aa2 --- /dev/null +++ b/stock_location_pending_move/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Denis Roussel +- Guewen Baconnier +- Akim Juillerat +- Alexandre Fayolle diff --git a/stock_location_pending_move/readme/DESCRIPTION.md b/stock_location_pending_move/readme/DESCRIPTION.md new file mode 100644 index 000000000..0bc0e91c4 --- /dev/null +++ b/stock_location_pending_move/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +This module allows to access incoming and ougoing pending moves from +a stock location. + +- Stock Location view: + +![Pending Moves](../static/description/pending_moves.png) + +- Detail grouped per origin location: + +![Detailed view](../static/description/pending_moves_detail.png) \ No newline at end of file diff --git a/stock_location_pending_move/readme/USAGE.md b/stock_location_pending_move/readme/USAGE.md new file mode 100644 index 000000000..375ed1378 --- /dev/null +++ b/stock_location_pending_move/readme/USAGE.md @@ -0,0 +1,6 @@ +- Storage Locations should have been enabled. +- Go to Inventory > Configuration > Warehouse Management > Locations +- Click on 'Pending Move' to see stock moves. +- Click on 'Pending Operations' to see detailed operations. +- By default, the moves are displayed grouped by source location in order + to easy review if there are plenty of moves. diff --git a/stock_location_pending_move/static/description/icon.png b/stock_location_pending_move/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_location_pending_move/static/description/icon.png differ diff --git a/stock_location_pending_move/static/description/index.html b/stock_location_pending_move/static/description/index.html new file mode 100644 index 000000000..18594655b --- /dev/null +++ b/stock_location_pending_move/static/description/index.html @@ -0,0 +1,475 @@ + + + + + +Stock Location Pending Move + + + +
+

Stock Location Pending Move

+ + +

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

+

This module allows to access incoming and ougoing pending moves from a +stock location.

+
    +
  • Stock Location view:
  • +
+

Pending Moves

+
    +
  • Detail grouped per origin location:
  • +
+

Detailed view

+

Table of contents

+ +
+

Use Cases / Context

+

When user wants to make a diagnostic on a particular stock location, it +is useful to have pending stock moves that will go in or go out (you can +also go to ‘Moves History’ but you need to use a filter on stock +location).

+
+
+

Configuration

+

[ This file is not always required; it should explain how to configure +the module before using it; it is aimed at users with administration +privileges.

+

Please be detailed on the path to configuration (eg: do you need to +activate developer mode?), describe step by step configurations and the +use of screenshots is strongly recommended.]

+

To configure this module, you need to:

+
    +
  • Go to App > Menu > Menu item
  • +
  • Activate boolean… > save
  • +
  • +
+
+
+

Usage

+
    +
  • Storage Locations should have been enabled.
  • +
  • Go to Inventory > Configuration > Warehouse Management > Locations
  • +
  • Click on ‘Pending Move’ to see stock moves.
  • +
  • Click on ‘Pending Operations’ to see detailed operations.
  • +
  • By default, the moves are displayed grouped by source location in +order to easy review if there are plenty of moves.
  • +
+
+
+

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

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.

+

Current maintainers:

+

rousseldenis jbaudoux

+

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_pending_move/static/description/pending_moves.png b/stock_location_pending_move/static/description/pending_moves.png new file mode 100644 index 000000000..986add685 Binary files /dev/null and b/stock_location_pending_move/static/description/pending_moves.png differ diff --git a/stock_location_pending_move/static/description/pending_moves_detail.png b/stock_location_pending_move/static/description/pending_moves_detail.png new file mode 100644 index 000000000..04b81d1fa Binary files /dev/null and b/stock_location_pending_move/static/description/pending_moves_detail.png differ diff --git a/stock_location_pending_move/tests/__init__.py b/stock_location_pending_move/tests/__init__.py new file mode 100644 index 000000000..85a321c2d --- /dev/null +++ b/stock_location_pending_move/tests/__init__.py @@ -0,0 +1 @@ +from . import test_location_pending_move diff --git a/stock_location_pending_move/tests/test_location_pending_move.py b/stock_location_pending_move/tests/test_location_pending_move.py new file mode 100644 index 000000000..d67f4c4f3 --- /dev/null +++ b/stock_location_pending_move/tests/test_location_pending_move.py @@ -0,0 +1,48 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.osv.expression import AND + +from odoo.addons.base.tests.common import BaseCommon + +from ..models.stock_location import PENDING_MOVE_DOMAIN + + +class TestLocationPendingMove(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.stock = cls.env.ref("stock.stock_location_stock") + + def test_location_pending_move(self): + # Check that the action domain is well filled with pending moves ids. + domain = AND( + [ + [ + "|", + ("location_id", "=", self.stock.id), + ("location_dest_id", "=", self.stock.id), + ], + PENDING_MOVE_DOMAIN, + ] + ) + moves = self.env["stock.move"].search(domain) + action = self.stock.action_show_pending_stock_moves() + self.assertDictContainsSubset({"domain": [("id", "in", moves.ids)]}, action) + + def test_location_pending_move_line(self): + # Check that the action domain is well filled with pending move lines ids. + domain = AND( + [ + [ + "|", + ("location_id", "=", self.stock.id), + ("location_dest_id", "=", self.stock.id), + ], + PENDING_MOVE_DOMAIN, + ] + ) + move_lines = self.env["stock.move.line"].search(domain) + action = self.stock.action_show_pending_stock_move_lines() + self.assertDictContainsSubset( + {"domain": [("id", "in", move_lines.ids)]}, action + ) diff --git a/stock_location_pending_move/views/stock_location.xml b/stock_location_pending_move/views/stock_location.xml new file mode 100644 index 000000000..755dfd652 --- /dev/null +++ b/stock_location_pending_move/views/stock_location.xml @@ -0,0 +1,34 @@ + + + + + + stock.location + + +
+
+ +
+
+ +