Skip to content

Commit 4635017

Browse files
committed
Merge PR #257 into 16.0
Signed-off-by jbaudoux
2 parents 469d732 + d46c24f commit 4635017

34 files changed

+1836
-0
lines changed

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ select = C,E,F,W,B,B9
1010
ignore = E203,E501,W503
1111
per-file-ignores=
1212
__init__.py:F401
13+
stock_average_daily_sale/models/stock_average_daily_sale.py:B950

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# generated from manifests external_dependencies
2+
freezegun
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_average_daily_sale
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

stock_average_daily_sale/README.rst

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
========================
2+
Stock Average Daily Sale
3+
========================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github
17+
:target: https://github.com/OCA/stock-logistics-reporting/tree/16.0/stock_average_daily_sale
18+
:alt: OCA/stock-logistics-reporting
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-16-0/stock-logistics-reporting-16-0-stock_average_daily_sale
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/151/16.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module allows to gather stock consumptions and build reporting for average daily
29+
sales (aka stock consumptions). Technically, this has been done through a
30+
materialized postgresql view in order to be as fast as possible (some other flow
31+
modules can depend on this).
32+
33+
You can add several configurations depending on the window you want to analyze.
34+
So, you can define criteria to filter data:
35+
36+
* The Warehouse
37+
* The product ABC classification
38+
* The location kind (Zone, Area, Bin)
39+
* The amount of time to look backward (in days or weeks or months or years)
40+
41+
Moreover, you can define:
42+
43+
* A safety factor
44+
* A standard deviation exclusion factor
45+
46+
**Table of contents**
47+
48+
.. contents::
49+
:local:
50+
51+
Configuration
52+
=============
53+
54+
#. To configure data analysis, you should go to Inventory > Configuration > Average daily sales computation parameters
55+
56+
#. You need to fill in the following informations:
57+
58+
* The product ABC classification you want - see product_abc_classification module
59+
* The concerned Warehouse
60+
* The stock location kind (Zone, Area, Bin) - see stock_location_zone module
61+
* The period of time to analyze back (in days/weeks/months/years)
62+
* A standard deviation exclusion factor
63+
* A safety factor
64+
65+
#. Go to Configuration > Technical > Scheduled Actions > Refresh average daily sales materialized view
66+
67+
By default, the sceduled action is set to refresh data each 4 hours. You can change
68+
that depending on your needs.
69+
70+
Known issues / Roadmap
71+
======================
72+
73+
* Move the filter on saturday/sunday to configuration parameters
74+
* An extensible data gathering query
75+
76+
Changelog
77+
=========
78+
79+
16.0.1.0.0 (2023-01-13)
80+
~~~~~~~~~~~~~~~~~~~~~~~
81+
82+
* [16.0][ADD] stock_average_daily_sale
83+
84+
Bug Tracker
85+
===========
86+
87+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/issues>`_.
88+
In case of trouble, please check there if your issue has already been reported.
89+
If you spotted it first, help us smashing it by providing a detailed and welcomed
90+
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_average_daily_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
91+
92+
Do not contact contributors directly about support or help with technical issues.
93+
94+
Credits
95+
=======
96+
97+
Authors
98+
~~~~~~~
99+
100+
* ACSONE SA/NV
101+
102+
Contributors
103+
~~~~~~~~~~~~
104+
105+
* Laurent Mignon <laurent.mignon@acsone.eu>
106+
* Denis Roussel <denis.roussel@acsone.eu>
107+
108+
Maintainers
109+
~~~~~~~~~~~
110+
111+
This module is maintained by the OCA.
112+
113+
.. image:: https://odoo-community.org/logo.png
114+
:alt: Odoo Community Association
115+
:target: https://odoo-community.org
116+
117+
OCA, or the Odoo Community Association, is a nonprofit organization whose
118+
mission is to support the collaborative development of Odoo features and
119+
promote its widespread use.
120+
121+
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/16.0/stock_average_daily_sale>`_ project on GitHub.
122+
123+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

stock_average_daily_sale/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models, wizards
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Average Daily Sale",
6+
"summary": """
7+
Allows to gather delivered products average on daily basis""",
8+
"version": "16.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/stock-logistics-reporting",
12+
"depends": [
13+
"sale",
14+
"stock_storage_type_putaway_abc",
15+
"product_abc_classification",
16+
"product_abc_classification_sale_stock",
17+
"product_route_mto",
18+
],
19+
"data": [
20+
"security/stock_average_daily_sale_config.xml",
21+
"security/stock_average_daily_sale.xml",
22+
"security/stock_average_daily_sale_demo.xml",
23+
"views/stock_average_daily_sale_config.xml",
24+
"views/stock_average_daily_sale.xml",
25+
"views/abc_classification_profile.xml",
26+
"views/stock_warehouse.xml",
27+
"data/ir_cron.xml",
28+
],
29+
"external_dependencies": {"python": ["freezegun"]},
30+
"demo": [
31+
"demo/stock_average_daily_sale_config.xml",
32+
"demo/stock_move.xml",
33+
],
34+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
<record forcecreate="True" id="refresh_materialized_view" model="ir.cron">
4+
<field name="name">Refresh average daily sales materialized view</field>
5+
<field name="active" eval="True" />
6+
<field name="user_id" ref="base.user_root" />
7+
<field name="interval_number">4</field>
8+
<field name="interval_type">hours</field>
9+
<field name="numbercall">-1</field>
10+
<field name="doall" eval="False" />
11+
<field name="model_id" ref="model_stock_average_daily_sale" />
12+
<field name="code">model.refresh_view()</field>
13+
<field name="state">code</field>
14+
</record>
15+
16+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2021 ACSONE SA/NV
3+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4+
<odoo noupdate="1">
5+
<record
6+
model="stock.average.daily.sale.config"
7+
id="stock_average_daily_sale_config_level_a"
8+
>
9+
<field
10+
name="abc_classification_profile_id"
11+
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
12+
/>
13+
<field name="abc_classification_level">a</field>
14+
<field name="period_value">2</field>
15+
<field name="period_name">week</field>
16+
<field name="standard_deviation_exclude_factor">3</field>
17+
<field name="safety_factor">0.3</field>
18+
<field name="number_days_qty_in_stock">2</field>
19+
</record>
20+
<record
21+
model="stock.average.daily.sale.config"
22+
id="stock_average_daily_sale_config_level_b"
23+
>
24+
<field
25+
name="abc_classification_profile_id"
26+
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
27+
/>
28+
<field name="abc_classification_level">b</field>
29+
<field name="period_value">13</field>
30+
<field name="period_name">week</field>
31+
<field name="standard_deviation_exclude_factor">3</field>
32+
<field name="safety_factor">0.3</field>
33+
<field name="number_days_qty_in_stock">2</field>
34+
</record>
35+
<record
36+
model="stock.average.daily.sale.config"
37+
id="stock_average_daily_sale_config_level_c"
38+
>
39+
<field
40+
name="abc_classification_profile_id"
41+
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
42+
/>
43+
<field name="abc_classification_level">c</field>
44+
<field name="period_value">26</field>
45+
<field name="period_name">week</field>
46+
<field name="standard_deviation_exclude_factor">3</field>
47+
<field name="safety_factor">0.3</field>
48+
<field name="number_days_qty_in_stock">2</field>
49+
</record>
50+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2023 ACSONE SA/NV
3+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4+
<odoo noupdate="1">
5+
6+
<function model="stock.average.daily.sale.demo" name="_action_create_data" />
7+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from . import stock_warehouse # isort:skip
2+
from . import stock_average_daily_sale_config # isort:skip
3+
from . import stock_average_daily_sale # isort:skip
4+
from . import abc_classification_profile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class AbcClassificationProfile(models.Model):
8+
9+
_inherit = "abc.classification.profile"
10+
11+
stock_average_daily_sale_config_ids = fields.One2many(
12+
comodel_name="stock.average.daily.sale.config",
13+
inverse_name="abc_classification_profile_id",
14+
string="Average Daily Sale Configurations",
15+
)

0 commit comments

Comments
 (0)