-
-
Notifications
You must be signed in to change notification settings - Fork 291
[18.0][MIG] stock_average_daily_sale #481
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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
76927b6
6a08cb3
24da91d
b68b2ad
c84556e
0972a77
3c1f2b4
720b1b8
d0c4a12
76949d3
418fae6
d2f3ee6
ef74524
a9762f3
2e883e9
8e4ee93
dec61ff
e32e610
ddcb73a
eb5e2ef
ea59984
2349d76
033be95
c9f83e5
b8a136a
deb1602
3760faf
0b69fe6
905d470
2e9ea08
5485044
4b6c1b9
3a1cdf1
bdbad17
87c0829
5ffb6b0
3019c99
a57f5e0
58cc98f
27c782c
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,2 @@ | ||
| # generated from manifests external_dependencies | ||
| freezegun |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| ======================== | ||
| Stock Average Daily Sale | ||
| ======================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:b54bb634caae34c163c90bd755fa3a89a454b9f6998b2df7d19295334857643a | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |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/18.0/stock_average_daily_sale | ||
| :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-18-0/stock-logistics-reporting-18-0-stock_average_daily_sale | ||
| :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=18.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module allows to gather stock consumptions and build reporting for | ||
| average daily consumptions. Technically, this has been done through a | ||
| materialized postgresql view in order to be as fast as possible (some | ||
| other flow modules can depend on this). | ||
|
|
||
| You can add several configurations depending on the location from which | ||
| consumptions are counted. | ||
|
|
||
| For each product ABC classification, you can define the computation | ||
| horizon, i.e. the amount of time to look backward (in days or weeks or | ||
| months or years). | ||
|
|
||
| You can exclude some days of the week like saturday and sunday from the | ||
| computation. However, if moves occurs on those excluded days, they are | ||
| still counted. If your warehouse is open usualy on week days, the | ||
| averages will be on 5 days a week. If the warehouse had some activity | ||
| during the week-end, this will be considered in the total and average as | ||
| if it happened during weekdays. | ||
|
|
||
| The report also provides a recommended quantity. That recommended | ||
| quantity is the biggest between: - a coverage in days \* the average | ||
| daily consumption + a safety - a coverage in days \* the average | ||
| consumption | ||
|
|
||
| The second part tries to better recommend a quantity for C products. The | ||
| safety is computed as: daily standard deviation \* sqrt(coverage) \* a | ||
| safety factor It is up to you to configure the safety factor. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| - To configure data analysis, you should go to Inventory > Configuration | ||
| > Average daily sales computation parameters | ||
|
|
||
| - You need to fill in the following informations: | ||
|
|
||
| - The product ABC classification you want - see | ||
| product_abc_classification module | ||
| - The concerned warehouse | ||
| - The stock location for which you want to compute the usage | ||
| - The period of time to analyze back (in days/weeks/months/years) | ||
| - A safety factor | ||
|
|
||
| - Go to Configuration > Technical > Scheduled Actions > Refresh average | ||
| daily sales materialized view | ||
|
|
||
| By default, the scheduled action is set to refresh data each day. Note | ||
| that the current day is not take into consideration in the | ||
| computations, so you better run the scheduled action on the early | ||
| morning. | ||
|
|
||
| WARNING: The current query is not TZ compliant. So the cron must run | ||
| after midnight UTC time. | ||
|
|
||
| - By default, the root location where analysis is done is the Warehouse | ||
| stock location, but you can change it and you can compute usage for | ||
| multiple locations of the warehouse. Ensure to set a location that is | ||
| used by the stock moves or a parent one. | ||
|
|
||
| Known issues / Roadmap | ||
| ====================== | ||
|
|
||
| - Allow to exclude specific days | ||
| - An extensible data gathering query | ||
| - Make it timezone compliant | ||
|
|
||
| Changelog | ||
| ========= | ||
|
|
||
| 16.0.1.0.0 (2023-01-13) | ||
| ----------------------- | ||
|
|
||
| - [16.0][ADD] stock_average_daily_sale | ||
|
|
||
| 16.0.2.0.0 (2025-04-05) | ||
| ----------------------- | ||
|
|
||
| - [16.0][REF] refactor formulas for proper metrics | ||
|
|
||
| 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_average_daily_sale%0Aversion:%2018.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 | ||
| * BCIM | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - Laurent Mignon <laurent.mignon@acsone.eu> | ||
| - Denis Roussel <denis.roussel@acsone.eu> | ||
| - Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
| - Tomasz Walter <tomasz.walter@camptocamp.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. | ||
|
|
||
| .. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px | ||
| :target: https://github.com/jbaudoux | ||
| :alt: jbaudoux | ||
|
|
||
| Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
|
||
| |maintainer-jbaudoux| | ||
|
|
||
| This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/18.0/stock_average_daily_sale>`_ 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, wizards |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Copyright 2023 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Stock Average Daily Sale", | ||
| "summary": """ | ||
| Allows to gather consumed products on daily basis""", | ||
| "version": "18.0.1.0.0", | ||
| "license": "AGPL-3", | ||
| "author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)", | ||
| "maintainers": ["jbaudoux"], | ||
| "website": "https://github.com/OCA/stock-logistics-reporting", | ||
| "depends": [ | ||
| "sale", | ||
|
Contributor
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. It should only depend on stock |
||
| "stock_storage_type_putaway_abc", | ||
|
Contributor
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. I would like to drop this strong dependency and move it to a glue module. Or even better, replace it with a products applicability domain. At the end, it is the only thing that it is doing. Also it would be better to use the abc product classification level that is at product.product level (abc_storage is only at product.template level) and that supports multi-warehouses through the abc profiles. |
||
| "product_route_mto", | ||
|
Contributor
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. MTO should move to another glue module. It doesn't provide any value to this ADU computation. New module: stock_average_daily_usage_mto |
||
| ], | ||
| "data": [ | ||
| "security/stock_average_daily_sale_config.xml", | ||
| "security/stock_average_daily_sale.xml", | ||
| "security/stock_average_daily_sale_demo.xml", | ||
| "views/stock_average_daily_sale_config.xml", | ||
| "views/stock_average_daily_sale.xml", | ||
| "data/ir_cron.xml", | ||
| ], | ||
| "external_dependencies": {"python": ["freezegun"]}, | ||
| "demo": [ | ||
| "demo/stock_average_daily_sale_config.xml", | ||
| "demo/stock_move.xml", | ||
| ], | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <odoo noupdate="1"> | ||
| <record forcecreate="True" id="refresh_materialized_view" model="ir.cron"> | ||
| <field name="name">Refresh average daily sales materialized view</field> | ||
| <field name="active" eval="True" /> | ||
| <field name="user_id" ref="base.user_root" /> | ||
| <field name="interval_number">24</field> | ||
| <field name="interval_type">hours</field> | ||
| <field name="model_id" ref="model_stock_average_daily_sale" /> | ||
| <field name="code">model.refresh_view()</field> | ||
| <field name="state">code</field> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright 2021 ACSONE SA/NV | ||
| License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
| <odoo noupdate="1"> | ||
| <record | ||
| model="stock.average.daily.sale.config" | ||
| id="stock_average_daily_sale_config_level_a" | ||
| > | ||
| <field name="abc_classification_level">a</field> | ||
| <field name="period_value">2</field> | ||
| <field name="period_name">week</field> | ||
| <field name="safety_factor">0.3</field> | ||
| <field name="number_days_qty_in_stock">2</field> | ||
| <field name="exclude_weekends">1</field> | ||
| <field name="warehouse_id" ref="stock.warehouse0" /> | ||
| <field name="company_id" ref="base.main_company" /> | ||
| </record> | ||
| <record | ||
| model="stock.average.daily.sale.config" | ||
| id="stock_average_daily_sale_config_level_b" | ||
| > | ||
| <field name="abc_classification_level">b</field> | ||
| <field name="period_value">13</field> | ||
| <field name="period_name">week</field> | ||
| <field name="safety_factor">0.3</field> | ||
| <field name="number_days_qty_in_stock">2</field> | ||
| <field name="exclude_weekends">1</field> | ||
| <field name="warehouse_id" ref="stock.warehouse0" /> | ||
| <field name="company_id" ref="base.main_company" /> | ||
| </record> | ||
| <record | ||
| model="stock.average.daily.sale.config" | ||
| id="stock_average_daily_sale_config_level_c" | ||
| > | ||
| <field name="abc_classification_level">c</field> | ||
| <field name="period_value">26</field> | ||
| <field name="period_name">week</field> | ||
| <field name="safety_factor">0.3</field> | ||
| <field name="number_days_qty_in_stock">2</field> | ||
| <field name="exclude_weekends">1</field> | ||
| <field name="warehouse_id" ref="stock.warehouse0" /> | ||
| <field name="company_id" ref="base.main_company" /> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright 2023 ACSONE SA/NV | ||
| License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
| <odoo noupdate="1"> | ||
| <function model="stock.average.daily.sale.demo" name="_action_create_data" /> | ||
| </odoo> |
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.
Can we rename the module to