[14.0][ADD] stock_quant_reservation_info

This commit is contained in:
DavidJForgeFlow
2022-09-29 17:14:09 +02:00
committed by Meritxell Abellan
parent 583c66a33b
commit db2ac23a72
11 changed files with 132 additions and 0 deletions

View File

View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models

View File

@@ -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,
}

View File

@@ -0,0 +1,2 @@
from . import stock_quant
from . import stock_move_line

View File

@@ -0,0 +1,16 @@
# Copyright 2022 ForgeFlow <http://www.forgeflow.com>
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

View File

@@ -0,0 +1,31 @@
# Copyright 2022 ForgeFlow <http://www.forgeflow.com>
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

View File

@@ -0,0 +1 @@
* David Jiménez <david.jimenez@forgeflow.com>

View File

@@ -0,0 +1 @@
This module allows to look which pickings, manufacture orders, etc. are reserving the products and check the following source.

View File

@@ -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.

View File

@@ -0,0 +1,22 @@
<odoo>
<record id="view_stock_move_line_reserved_info_tree" model="ir.ui.view">
<field name="name">stock.move.line.tree.reserved.info</field>
<field name="model">stock.move.line</field>
<field name="arch" type="xml">
<tree>
<field name="move_id" />
<field name="picking_id" />
<button
name="action_view_picking_from_reserved"
type="object"
class="btn btn-link text-info"
icon="fa-arrow-right"
title="Related Document"
attrs="{'invisible': [('picking_id', '=', False)]}"
/>
<field name="origin" />
<field name="product_uom_qty" />
</tree>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,39 @@
<odoo>
<record id="view_stock_quant_tree_reserved_quantity_editable" model="ir.ui.view">
<field name="name">stock.quant.inherit.form.reserved.quant.editable</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree_editable" />
<field name="arch" type="xml">
<field name="available_quantity" position="after">
<field name="reserved_quantity" optional="show" />
<button
name="action_reserved_moves"
type="object"
attrs="{'invisible': [('reserved_quantity', '=', 0)]}"
class="btn btn-link text-info"
icon="fa-info-circle"
title="Reserved Moves"
/>
</field>
</field>
</record>
<record id="view_stock_quant_tree_reserved_quantity" model="ir.ui.view">
<field name="name">stock.quant.inherit.form.reserved.quant</field>
<field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree" />
<field name="arch" type="xml">
<field name="available_quantity" position="after">
<field name="reserved_quantity" optional="show" />
<button
name="action_reserved_moves"
type="object"
attrs="{'invisible': [('reserved_quantity', '=', 0)]}"
class="btn btn-link text-info"
icon="fa-info-circle"
title="Reserved Moves"
/>
</field>
</field>
</record>
</odoo>