-
-
Notifications
You must be signed in to change notification settings - Fork 239
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.0][ADD] stock_storage_category_usage_report #352
base: 16.0
Are you sure you want to change the base?
Changes from all commits
06d9d5f
1a5a59d
7a760b7
d454ebc
7041bd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_storage_category_usage_report |
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, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
=================================== | ||
Stock Storage Category Usage Report | ||
=================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:0053ca728015cbb69203234451fd3d51c413c65ebc82eda0572c52f0f3b7b93a | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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--reporting-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-reporting/tree/16.0/stock_storage_category_usage_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-16-0/stock-logistics-reporting-16-0-stock_storage_category_usage_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=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to get reporting on stock storage categories about | ||
their locations usage. | ||
|
||
|Usage Report| | ||
|
||
.. |Usage Report| image:: https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_storage_category_usage_report/static/description/usage_report.png | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
When users want to manage their stock locations in a better way, they | ||
need those locations' usage (empty/filled in). | ||
|
||
Usage | ||
===== | ||
|
||
- Go to Inventory > Analysis > Stock Storage Category Usage Report | ||
- Each category will contain a fill rate depending on the occupation of | ||
all its children locations. It will display also the number of empty | ||
and filled locations. | ||
- The fill rate is also present on storage categories level. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/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-reporting/issues/new?body=module:%20stock_storage_category_usage_report%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 | ||
------- | ||
|
||
* ACSONE SA/NV | ||
|
||
Contributors | ||
------------ | ||
|
||
- Denis Roussel [email protected] | ||
|
||
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 <https://github.com/OCA/stock-logistics-reporting/tree/16.0/stock_storage_category_usage_report>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Storage Category Usage Report", | ||
"summary": """ | ||
This module allows to get reporting on stock storage categories | ||
about their locations usage""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-reporting", | ||
"depends": [ | ||
"stock", | ||
"stock_location_children", | ||
"stock_location_fill_state", | ||
"web_widget_progressbar_gradient", | ||
], | ||
"data": [ | ||
"views/stock_storage_category.xml", | ||
], | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,73 @@ | ||||||
# Translation of Odoo Server. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename file to |
||||||
# This file contains the translation of the following modules: | ||||||
# * stock_storage_category_usage_report | ||||||
# | ||||||
msgid "" | ||||||
msgstr "" | ||||||
"Project-Id-Version: Odoo Server 16.0+e\n" | ||||||
"Report-Msgid-Bugs-To: \n" | ||||||
"POT-Creation-Date: 2024-11-19 13:25+0000\n" | ||||||
"PO-Revision-Date: 2024-11-19 13:25+0000\n" | ||||||
"Last-Translator: \n" | ||||||
"Language-Team: \n" | ||||||
"MIME-Version: 1.0\n" | ||||||
"Content-Type: text/plain; charset=UTF-8\n" | ||||||
"Content-Transfer-Encoding: \n" | ||||||
"Plural-Forms: \n" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,field_description:stock_storage_category_usage_report.field_stock_storage_category__empty_location_ids | ||||||
msgid "Empty Location" | ||||||
msgstr "Emplacement vide" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,field_description:stock_storage_category_usage_report.field_stock_storage_category__empty_location_count | ||||||
msgid "Empty Location Count" | ||||||
msgstr "Nombre d'emplacements vides" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,field_description:stock_storage_category_usage_report.field_stock_storage_category__fill_rate | ||||||
msgid "Fill Rate" | ||||||
msgstr "Taux de remplissage" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,field_description:stock_storage_category_usage_report.field_stock_storage_category__filled_location_ids | ||||||
msgid "Filled Location" | ||||||
msgstr "Emplacement occupé" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,field_description:stock_storage_category_usage_report.field_stock_storage_category__filled_location_count | ||||||
msgid "Filled Location Count" | ||||||
msgstr "Nombre d'emplacements remplis" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.actions.act_window,name:stock_storage_category_usage_report.report_storage_category_usage_act_window | ||||||
#: model:ir.ui.menu,name:stock_storage_category_usage_report.report_storage_category_root_menu | ||||||
#: model:ir.ui.menu,name:stock_storage_category_usage_report.report_storage_category_view_menu | ||||||
msgid "Stock Storage Category Usage Report" | ||||||
msgstr "Rapport d'utilisation des catégories d'empalcement" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) ou Rapport de taux de remplissage
Suggested change
|
||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model,name:stock_storage_category_usage_report.model_stock_storage_category | ||||||
msgid "Storage Category" | ||||||
msgstr "Catégories d'emplacement" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,help:stock_storage_category_usage_report.field_stock_storage_category__empty_location_ids | ||||||
msgid "These are the empty locations having this storage category" | ||||||
msgstr "Ce sont les emplacements vides qui ont cette catégorie" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,help:stock_storage_category_usage_report.field_stock_storage_category__filled_location_ids | ||||||
msgid "These are the filled locations having this storage category" | ||||||
msgstr "Ce sont les emplacements remplis qui ont cette catégorie" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,help:stock_storage_category_usage_report.field_stock_storage_category__empty_location_count | ||||||
msgid "This is the number of empty locations having this storage category" | ||||||
msgstr "Le nombre d'emplacement vides qui ont cette catégorie" | ||||||
|
||||||
#. module: stock_storage_category_usage_report | ||||||
#: model:ir.model.fields,help:stock_storage_category_usage_report.field_stock_storage_category__filled_location_count | ||||||
msgid "This is the number of occupied locations having this storage category" | ||||||
msgstr "Le nombre d'emplacements occupés qui ont cette catégorie" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_storage_category |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,66 @@ | ||||||
# Copyright 2024 ACSONE SA/NV | ||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||||||
from odoo import api, fields, models | ||||||
|
||||||
|
||||||
class StockStorageCategory(models.Model): | ||||||
|
||||||
_inherit = "stock.storage.category" | ||||||
|
||||||
empty_location_ids = fields.Many2many( | ||||||
comodel_name="stock.location", | ||||||
compute="_compute_empty_location_ids", | ||||||
help="These are the empty locations having this storage category", | ||||||
) | ||||||
filled_location_ids = fields.Many2many( | ||||||
comodel_name="stock.location", | ||||||
compute="_compute_empty_location_ids", | ||||||
help="These are the filled locations having this storage category", | ||||||
) | ||||||
empty_location_count = fields.Integer( | ||||||
compute="_compute_empty_location_ids", | ||||||
search="_search_empty_location_count", | ||||||
help="This is the number of empty locations having this storage category", | ||||||
) | ||||||
filled_location_count = fields.Integer( | ||||||
compute="_compute_empty_location_ids", | ||||||
help="This is the number of occupied locations having this storage category", | ||||||
) | ||||||
fill_rate = fields.Float( | ||||||
compute="_compute_empty_location_ids", | ||||||
) | ||||||
|
||||||
def _get_locations_for_usage_report(self): | ||||||
# Return all storage locations and their children that | ||||||
# are not views. | ||||||
self.ensure_one() | ||||||
return (self.location_ids | self.location_ids.children_ids).filtered( | ||||||
lambda location: location.usage != "view" | ||||||
) | ||||||
|
||||||
@api.depends("location_ids.children_ids") | ||||||
def _compute_empty_location_ids(self): | ||||||
for category in self: | ||||||
all_locations = category._get_locations_for_usage_report() | ||||||
# Empty locations are locations empty and being emptied | ||||||
# (move qty is done but not yet validated). | ||||||
# We don't take into account filled and being filled moves. | ||||||
empty_locations = all_locations.filtered( | ||||||
lambda location: location.fill_state == "empty" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
filled_locations = all_locations - empty_locations | ||||||
if all_locations: | ||||||
fill_rate = float( | ||||||
100 - ((len(empty_locations) / len(all_locations)) * 100) | ||||||
) | ||||||
else: | ||||||
fill_rate = 0.0 | ||||||
category.update( | ||||||
{ | ||||||
"empty_location_ids": empty_locations.ids, | ||||||
"filled_location_ids": filled_locations.ids, | ||||||
"filled_location_count": len(filled_locations), | ||||||
"empty_location_count": len(empty_locations), | ||||||
"fill_rate": fill_rate, | ||||||
} | ||||||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,2 @@ | ||||||
When users want to manage their stock locations in a better way, | ||||||
they need those locations' usage (empty/filled in). | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe DESCRIPTION is enough. It's kind of repeating
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Denis Roussel <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This module allows to get reporting on stock storage categories | ||
about their locations usage. | ||
|
||
![Usage Report](../static/description/usage_report.png) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Go to Inventory > Analysis > Stock Storage Category Usage Report | ||
- Each category will contain a fill rate depending on the | ||
occupation of all its children locations. It will display also | ||
the number of empty and filled locations. | ||
- The fill rate is also present on storage categories level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about renaming to use
fill
instead ofusage
as this relates to that field?