diff --git a/stock_quant_reservation_info/README.rst b/stock_quant_reservation_info/README.rst new file mode 100644 index 000000000..e69de29bb diff --git a/stock_quant_reservation_info/__init__.py b/stock_quant_reservation_info/__init__.py new file mode 100644 index 000000000..4b76c7b2d --- /dev/null +++ b/stock_quant_reservation_info/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/stock_quant_reservation_info/__manifest__.py b/stock_quant_reservation_info/__manifest__.py new file mode 100644 index 000000000..ef07e3873 --- /dev/null +++ b/stock_quant_reservation_info/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2019-2020 ForgeFlow S.L. +# (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Stock Move Reservation Info", + "summary": "Allows to see the reserved info of Products", + "version": "14.0.1.0.3", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Generic", + "depends": ["stock"], + "license": "AGPL-3", + "data": ["views/stock_quant.xml", "views/stock_move_line.xml"], + "installable": True, +} diff --git a/stock_quant_reservation_info/models/__init__.py b/stock_quant_reservation_info/models/__init__.py new file mode 100644 index 000000000..cffdd8ca5 --- /dev/null +++ b/stock_quant_reservation_info/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_quant +from . import stock_move_line diff --git a/stock_quant_reservation_info/models/stock_move_line.py b/stock_quant_reservation_info/models/stock_move_line.py new file mode 100644 index 000000000..bb36805e1 --- /dev/null +++ b/stock_quant_reservation_info/models/stock_move_line.py @@ -0,0 +1,16 @@ +# Copyright 2022 ForgeFlow + +from odoo import models + + +class StockQuant(models.Model): + _inherit = "stock.move.line" + + def action_view_picking_from_reserved(self): + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.action_picking_tree_all" + ) + res = self.env.ref("stock.view_picking_form", False) + action["views"] = [(res and res.id or False, "form")] + action["res_id"] = self.picking_id.id + return action diff --git a/stock_quant_reservation_info/models/stock_quant.py b/stock_quant_reservation_info/models/stock_quant.py new file mode 100644 index 000000000..f836df0bb --- /dev/null +++ b/stock_quant_reservation_info/models/stock_quant.py @@ -0,0 +1,31 @@ +# Copyright 2022 ForgeFlow + +from odoo import _, models + + +class StockQuant(models.Model): + _inherit = "stock.quant" + + def action_reserved_moves(self): + self.ensure_one() + action = { + "name": _("Reserved moves for: " + self.product_id.name), + "view_mode": "list,form", + "res_model": "stock.move.line", + "views": [ + ( + self.env.ref( + "stock_quant_reservation_info.view_stock_move_line_reserved_info_tree" + ).id, + "list", + ), + (False, "form"), + ], + "type": "ir.actions.act_window", + "context": {}, + "domain": [ + ("product_id", "=", self.product_id.id), + ("product_uom_qty", ">", 0), + ], + } + return action diff --git a/stock_quant_reservation_info/readme/CONTRIBUTORS.rst b/stock_quant_reservation_info/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..fcd081018 --- /dev/null +++ b/stock_quant_reservation_info/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* David Jiménez diff --git a/stock_quant_reservation_info/readme/DESCRIPTION.rst b/stock_quant_reservation_info/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5ccbe26f3 --- /dev/null +++ b/stock_quant_reservation_info/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows to look which pickings, manufacture orders, etc. are reserving the products and check the following source. diff --git a/stock_quant_reservation_info/readme/USAGE.rst b/stock_quant_reservation_info/readme/USAGE.rst new file mode 100644 index 000000000..130acbc55 --- /dev/null +++ b/stock_quant_reservation_info/readme/USAGE.rst @@ -0,0 +1 @@ +Go to one product and check the quantity on hand, on that view you can see the quantity reserved and the button next to this field allows to see the pickings related to reservations. diff --git a/stock_quant_reservation_info/views/stock_move_line.xml b/stock_quant_reservation_info/views/stock_move_line.xml new file mode 100644 index 000000000..f0a7ed517 --- /dev/null +++ b/stock_quant_reservation_info/views/stock_move_line.xml @@ -0,0 +1,22 @@ + + + stock.move.line.tree.reserved.info + stock.move.line + + + + +