From fddf8215c408f75d9b1ad258dc6a1a6077e6b1b1 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Fri, 16 May 2025 11:05:07 +0100 Subject: [PATCH 1/3] [ADD] stock_move_variation_report --- stock_move_variation_report/README.rst | 84 ++++ stock_move_variation_report/__init__.py | 1 + stock_move_variation_report/__manifest__.py | 13 + .../models/__init__.py | 1 + .../models/stock_move_line.py | 29 ++ .../readme/DESCRIPTION.md | 5 + stock_move_variation_report/readme/USAGE.md | 3 + .../static/description/index.html | 427 ++++++++++++++++++ .../views/stock_move_line_view.xml | 13 + 9 files changed, 576 insertions(+) create mode 100644 stock_move_variation_report/README.rst create mode 100644 stock_move_variation_report/__init__.py create mode 100644 stock_move_variation_report/__manifest__.py create mode 100644 stock_move_variation_report/models/__init__.py create mode 100644 stock_move_variation_report/models/stock_move_line.py create mode 100644 stock_move_variation_report/readme/DESCRIPTION.md create mode 100644 stock_move_variation_report/readme/USAGE.md create mode 100644 stock_move_variation_report/static/description/index.html create mode 100644 stock_move_variation_report/views/stock_move_line_view.xml diff --git a/stock_move_variation_report/README.rst b/stock_move_variation_report/README.rst new file mode 100644 index 000000000..cbbb05fee --- /dev/null +++ b/stock_move_variation_report/README.rst @@ -0,0 +1,84 @@ +========================================= +Stock Move Report Show Quantity Variation +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d88d134f06a018f1868d83ff928c3f2a0242c4f11eaa65be415ca897c4f13424 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_move_variation_report + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_move_variation_report + :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-reporting&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +The Product Moves Report lists quantities moved for products. However it +can be hard to identify the stock quantity variations. + +This feature adds a column with the quantity variation for each move. +Incoming moves are a positive variation, and outgoing moves are a +negative variation. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Open the menu Inventory / Reporting / Product Moves. + +Use the three dot icon on the top left to make the "Qty Variation" +column visible. + +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 +------- + +* Open Source Integrators + +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-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_move_variation_report/__init__.py b/stock_move_variation_report/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_move_variation_report/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_move_variation_report/__manifest__.py b/stock_move_variation_report/__manifest__.py new file mode 100644 index 000000000..e60b5cad6 --- /dev/null +++ b/stock_move_variation_report/__manifest__.py @@ -0,0 +1,13 @@ +# © 2025 Daniel Reis - Open Source Integrators +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +{ + "name": "Stock Move Report Show Quantity Variation", + "summary": "Show quantity variation the the Inventory Moves report", + "version": "14.0.1.0.0", + "category": "Warehouse Management", + "website": "https://github.com/OCA/stock-logistics-reporting", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "license": "LGPL-3", + "depends": ["stock_account"], + "data": ["views/stock_move_line_view.xml"], +} diff --git a/stock_move_variation_report/models/__init__.py b/stock_move_variation_report/models/__init__.py new file mode 100644 index 000000000..431f51c27 --- /dev/null +++ b/stock_move_variation_report/models/__init__.py @@ -0,0 +1 @@ +from . import stock_move_line diff --git a/stock_move_variation_report/models/stock_move_line.py b/stock_move_variation_report/models/stock_move_line.py new file mode 100644 index 000000000..d8b8bff93 --- /dev/null +++ b/stock_move_variation_report/models/stock_move_line.py @@ -0,0 +1,29 @@ +# © 2025 Daniel Reis - Open Source Integrators +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + qty_variation = fields.Float( + compute="_compute_qty_variation", + store=True, + ) + + def _get_qty_variation_sign(self): + self.ensure_one() + if self.move_id._is_in(): + return 1 + elif self.move_id._is_out(): + return -1 + else: + return 0 + + @api.depends( + "product_uom_qty", "product_qty", "location_id.usage", "location_dest_id.usage" + ) + def _compute_qty_variation(self): + for line in self: + line.qty_variation = line.qty_done * line._get_qty_variation_sign() diff --git a/stock_move_variation_report/readme/DESCRIPTION.md b/stock_move_variation_report/readme/DESCRIPTION.md new file mode 100644 index 000000000..df62ab564 --- /dev/null +++ b/stock_move_variation_report/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +The Product Moves Report lists quantities moved for products. +However it can be hard to identify the stock quantity variations. + +This feature adds a column with the quantity variation for each move. +Incoming moves are a positive variation, and outgoing moves are a negative variation. diff --git a/stock_move_variation_report/readme/USAGE.md b/stock_move_variation_report/readme/USAGE.md new file mode 100644 index 000000000..addf400d7 --- /dev/null +++ b/stock_move_variation_report/readme/USAGE.md @@ -0,0 +1,3 @@ +Open the menu Inventory / Reporting / Product Moves. + +Use the three dot icon on the top left to make the "Qty Variation" column visible. diff --git a/stock_move_variation_report/static/description/index.html b/stock_move_variation_report/static/description/index.html new file mode 100644 index 000000000..3de6b6545 --- /dev/null +++ b/stock_move_variation_report/static/description/index.html @@ -0,0 +1,427 @@ + + + + + +Stock Move Report Show Quantity Variation + + + +
+

Stock Move Report Show Quantity Variation

+ + +

Beta License: LGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

+

The Product Moves Report lists quantities moved for products. However it +can be hard to identify the stock quantity variations.

+

This feature adds a column with the quantity variation for each move. +Incoming moves are a positive variation, and outgoing moves are a +negative variation.

+

Table of contents

+ +
+

Usage

+

Open the menu Inventory / Reporting / Product Moves.

+

Use the three dot icon on the top left to make the “Qty Variation” +column visible.

+
+
+

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

+
    +
  • Open Source Integrators
  • +
+
+
+

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.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_move_variation_report/views/stock_move_line_view.xml b/stock_move_variation_report/views/stock_move_line_view.xml new file mode 100644 index 000000000..26d24e28a --- /dev/null +++ b/stock_move_variation_report/views/stock_move_line_view.xml @@ -0,0 +1,13 @@ + + + stock.move.line + + + + + + + + + + From 27f8be3d626d4c59083afff781c1c3a8144ed563 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Mon, 2 Mar 2026 13:08:34 +0000 Subject: [PATCH 2/3] [IMP] stock_move_variation_report: pre-commit auto fixes --- stock_move_variation_report/README.rst | 10 +++++----- stock_move_variation_report/pyproject.toml | 3 +++ .../static/description/index.html | 6 +++--- .../views/stock_move_line_view.xml | 2 -- 4 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 stock_move_variation_report/pyproject.toml diff --git a/stock_move_variation_report/README.rst b/stock_move_variation_report/README.rst index cbbb05fee..8ca38d40f 100644 --- a/stock_move_variation_report/README.rst +++ b/stock_move_variation_report/README.rst @@ -17,13 +17,13 @@ Stock Move Report Show Quantity Variation :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/stock_move_variation_report + :target: https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_move_variation_report :alt: OCA/stock-logistics-reporting .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_move_variation_report + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-18-0/stock-logistics-reporting-18-0-stock_move_variation_report :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-reporting&target_branch=14.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -54,7 +54,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,6 +79,6 @@ 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-reporting `_ project on GitHub. +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_move_variation_report/pyproject.toml b/stock_move_variation_report/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/stock_move_variation_report/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_move_variation_report/static/description/index.html b/stock_move_variation_report/static/description/index.html index 3de6b6545..0adc77f54 100644 --- a/stock_move_variation_report/static/description/index.html +++ b/stock_move_variation_report/static/description/index.html @@ -369,7 +369,7 @@

Stock Move Report Show Quantity Variation

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:d88d134f06a018f1868d83ff928c3f2a0242c4f11eaa65be415ca897c4f13424 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

+

Beta License: LGPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

The Product Moves Report lists quantities moved for products. However it can be hard to identify the stock quantity variations.

This feature adds a column with the quantity variation for each move. @@ -398,7 +398,7 @@

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.

+feedback.

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

@@ -418,7 +418,7 @@

Maintainers

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-reporting project on GitHub.

+

This module is part of the OCA/stock-logistics-reporting project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/stock_move_variation_report/views/stock_move_line_view.xml b/stock_move_variation_report/views/stock_move_line_view.xml index 26d24e28a..96deee4cb 100644 --- a/stock_move_variation_report/views/stock_move_line_view.xml +++ b/stock_move_variation_report/views/stock_move_line_view.xml @@ -3,11 +3,9 @@ stock.move.line - - From 9f6477c46decb27ce907c6c4a8eda2ed354895d2 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Mon, 2 Mar 2026 13:11:18 +0000 Subject: [PATCH 3/3] [MIG] stock_move_variation_report: Migration to 18.0 --- stock_move_variation_report/__manifest__.py | 2 +- stock_move_variation_report/models/stock_move_line.py | 7 +++++-- stock_move_variation_report/views/stock_move_line_view.xml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stock_move_variation_report/__manifest__.py b/stock_move_variation_report/__manifest__.py index e60b5cad6..f62f3aa11 100644 --- a/stock_move_variation_report/__manifest__.py +++ b/stock_move_variation_report/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Move Report Show Quantity Variation", "summary": "Show quantity variation the the Inventory Moves report", - "version": "14.0.1.0.0", + "version": "18.0.1.0.0", "category": "Warehouse Management", "website": "https://github.com/OCA/stock-logistics-reporting", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/stock_move_variation_report/models/stock_move_line.py b/stock_move_variation_report/models/stock_move_line.py index d8b8bff93..5f6e782c9 100644 --- a/stock_move_variation_report/models/stock_move_line.py +++ b/stock_move_variation_report/models/stock_move_line.py @@ -22,8 +22,11 @@ def _get_qty_variation_sign(self): return 0 @api.depends( - "product_uom_qty", "product_qty", "location_id.usage", "location_dest_id.usage" + "quantity", + "move_id.product_uom_qty", + "location_id.usage", + "location_dest_id.usage", ) def _compute_qty_variation(self): for line in self: - line.qty_variation = line.qty_done * line._get_qty_variation_sign() + line.qty_variation = line.quantity * line._get_qty_variation_sign() diff --git a/stock_move_variation_report/views/stock_move_line_view.xml b/stock_move_variation_report/views/stock_move_line_view.xml index 96deee4cb..68dfed597 100644 --- a/stock_move_variation_report/views/stock_move_line_view.xml +++ b/stock_move_variation_report/views/stock_move_line_view.xml @@ -3,7 +3,7 @@ stock.move.line - +