Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16][ADD] stock_inventory_quantity_history #1992

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/stock_inventory_quantity_history/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
82 changes: 82 additions & 0 deletions stock_inventory_quantity_history/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
============================================
Stock Inventory Theoretical Quantity History
============================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e488fdd71dcc2f2221822c3c2284e3c3e4b7883580a8cb65e7bee28763b48f43
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_inventory_quantity_history
: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_inventory_quantity_history
: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|

When doing inventories, keep history of the theoretical and real quantity

**Table of contents**

.. contents::
:local:

Usage
=====

After validating an inventory, you can go to Inventory => Reporting => Moves History
On this screen you will find the 2 new fields containing the Theoretical and real quantity at the time the inventory was made.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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 <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_inventory_quantity_history%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* Florian da Costa <florian.dacosta@akretion.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.

This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_inventory_quantity_history>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions stock_inventory_quantity_history/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
17 changes: 17 additions & 0 deletions stock_inventory_quantity_history/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Akretion France (http://www.akretion.com/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Stock Inventory Theoretical Quantity History",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"summary": "Keep theoretical and real quantities history",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"depends": ["stock"],
"data": [
"views/stock_move_line_views.xml",
],
"installable": True,
}
4 changes: 4 additions & 0 deletions stock_inventory_quantity_history/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import stock_quant
from . import stock_move_line
18 changes: 18 additions & 0 deletions stock_inventory_quantity_history/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

inventory_theoretical_qty = fields.Float(
digits="Product Unit of Measure",
readonly=True,
help="Theoretical Quantity right before the inventory",
)
inventory_real_qty = fields.Float(
florian-dacosta marked this conversation as resolved.
Show resolved Hide resolved
digits="Product Unit of Measure",
readonly=True,
help="Real Quantity at the time of the inventory",
)
21 changes: 21 additions & 0 deletions stock_inventory_quantity_history/models/stock_quant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class StockQuant(models.Model):
_inherit = "stock.quant"

def _get_inventory_move_values(self, qty, location_id, location_dest_id, out=False):
vals = super()._get_inventory_move_values(
qty, location_id, location_dest_id, out=out
)
move_line_vals = vals["move_line_ids"][0][2]
# quantity before the adjustment
move_line_vals.update(
{
"inventory_theoretical_qty": self.quantity,
"inventory_real_qty": self.inventory_quantity,
}
)
return vals
1 change: 1 addition & 0 deletions stock_inventory_quantity_history/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Florian da Costa <florian.dacosta@akretion.com>
1 change: 1 addition & 0 deletions stock_inventory_quantity_history/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When doing inventories, keep history of the theoretical and real quantity
2 changes: 2 additions & 0 deletions stock_inventory_quantity_history/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
After validating an inventory, you can go to Inventory => Reporting => Moves History
On this screen you will find the 2 new fields containing the Theoretical and real quantity at the time the inventory was made.
Loading
Loading