From 802a1e1313f9ab408040bd0f987358da74cd2821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthieu=20M=C3=A9quignon?= Date: Wed, 28 Jul 2021 13:52:50 +0200 Subject: [PATCH] [13.0][ADD] stock_inventory_line package quantity --- stock_product_qty_by_packaging/__manifest__.py | 2 +- stock_product_qty_by_packaging/models/__init__.py | 1 + .../models/stock_inventory_line.py | 12 ++++++++++++ .../readme/DESCRIPTION.rst | 6 +++++- .../views/stock_inventory_line.xml | 15 +++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 stock_product_qty_by_packaging/models/stock_inventory_line.py create mode 100644 stock_product_qty_by_packaging/views/stock_inventory_line.xml diff --git a/stock_product_qty_by_packaging/__manifest__.py b/stock_product_qty_by_packaging/__manifest__.py index 3b5928740..c859b2e6b 100644 --- a/stock_product_qty_by_packaging/__manifest__.py +++ b/stock_product_qty_by_packaging/__manifest__.py @@ -11,5 +11,5 @@ "license": "LGPL-3", "installable": True, "depends": ["stock_packaging_calculator", "stock"], - "data": ["views/stock_picking.xml"], + "data": ["views/stock_picking.xml", "views/stock_inventory_line.xml"], } diff --git a/stock_product_qty_by_packaging/models/__init__.py b/stock_product_qty_by_packaging/models/__init__.py index 5676a7278..d438dc58a 100644 --- a/stock_product_qty_by_packaging/models/__init__.py +++ b/stock_product_qty_by_packaging/models/__init__.py @@ -1,3 +1,4 @@ +from . import stock_inventory_line from . import stock_move from . import stock_move_line from . import stock_quant diff --git a/stock_product_qty_by_packaging/models/stock_inventory_line.py b/stock_product_qty_by_packaging/models/stock_inventory_line.py new file mode 100644 index 000000000..e0c697d40 --- /dev/null +++ b/stock_product_qty_by_packaging/models/stock_inventory_line.py @@ -0,0 +1,12 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class StockInventoryLine(models.Model): + + _name = "stock.inventory.line" + _inherit = ["stock.inventory.line", "product.qty_by_packaging.mixin"] + + _qty_by_pkg__qty_field_name = "theoretical_qty" diff --git a/stock_product_qty_by_packaging/readme/DESCRIPTION.rst b/stock_product_qty_by_packaging/readme/DESCRIPTION.rst index 99b4b5930..5cb95da42 100644 --- a/stock_product_qty_by_packaging/readme/DESCRIPTION.rst +++ b/stock_product_qty_by_packaging/readme/DESCRIPTION.rst @@ -4,5 +4,9 @@ It adds product qty computed by packaging to: * stock move * stock move line * stock quant +* stock inventory line -and displays it for move line on stock picking view. +Displays it: + +* stock picking view for move line +* on inventory line tree view for stock_inventory_line diff --git a/stock_product_qty_by_packaging/views/stock_inventory_line.xml b/stock_product_qty_by_packaging/views/stock_inventory_line.xml new file mode 100644 index 000000000..3fe30f12d --- /dev/null +++ b/stock_product_qty_by_packaging/views/stock_inventory_line.xml @@ -0,0 +1,15 @@ + + + + + stock.inventory.line.tree.inherit + stock.inventory.line + + + + + + + +