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

14.0 stock average daily sale returns handling #349

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
35310da
[16.0][ADD] stock_average_daily_sale
rousseldenis Jan 13, 2023
bc6e262
[IMP] stock_average_daily_sale: Store the configurations on profile l…
rousseldenis Feb 14, 2023
77f2b6b
[IMP] stock_average_daily_sale: Improve profile view
rousseldenis Feb 15, 2023
798b4fd
[IMP] Remove zone location dependency, rely on warehouse only
rousseldenis Jul 13, 2023
bb11b7c
[IMP] stock_average_daily_sale: Improve tests
rousseldenis Jul 13, 2023
1b017da
[IMP] stock_average_daily_sale: Improve module helps / change field n…
rousseldenis Jul 13, 2023
dd12483
[FIX] stock_average_daily_sale: Don't exclude moves on priority
lmignon Jul 31, 2023
cabb14f
[IMP] stock_average_daily_sale: Don't use Odoo demo data
rousseldenis Sep 15, 2023
13300ee
[IMP] stock_average_daily_sale: add contributor
sbejaoui Oct 4, 2023
8ecd2cd
[IMP] stock_average_daily_sale: Avoid errors in all searches and retu…
rousseldenis Oct 10, 2023
171fd86
[FIX] stock_average_daily_sale: Use a new cursor to avoid closed one
rousseldenis Oct 11, 2023
ce97bf0
[FIX] stock_average_daily_sale: Don't test the not refreshed material…
rousseldenis Oct 11, 2023
0c2f631
[FIX] stock_average_daily_sale: Don't check the view existence in tests
rousseldenis Oct 11, 2023
fb2cee4
[FIX] stock_average_daily_sale: Don't rely on tuples as id
rousseldenis Oct 11, 2023
93fafe8
[IMP] stock_average_daily_sale: avoid concurrent update
lmignon Nov 21, 2023
0554c6d
[UPD] Update stock_average_daily_sale.pot
Apr 15, 2024
d3669c5
[BOT] post-merge updates
OCA-git-bot Apr 15, 2024
30ecb1b
Added translation using Weblate (Italian)
mymage Apr 19, 2024
972951b
Translated using Weblate (Italian)
mymage Apr 23, 2024
bf46239
stock_average_daily_sale: Remove product_abc_classification dependency
twalter-c2c Aug 27, 2024
59bf548
stock_average_daily_sale: Change default access rights
twalter-c2c Aug 27, 2024
fe2ac11
stock_average_daily_sale: Set default root location on WH
twalter-c2c Aug 27, 2024
98aeebf
stock_average_daily_sale: Allow to include/exclude weekends
twalter-c2c Aug 27, 2024
c7f4ecc
stock_average_daily_sale: Take production location into account
twalter-c2c Aug 27, 2024
feb91ff
stock_average_daily_sale: Config adjustment - add from view and compa…
twalter-c2c Aug 27, 2024
ed6ea72
stock_average_daily_sale: Pre-migration script
twalter-c2c Sep 13, 2024
105a321
stock_average_daily_sale: Specify WH on demo stock moves
twalter-c2c Sep 23, 2024
b4bcb66
[UPD] Update stock_average_daily_sale.pot
Sep 24, 2024
dd05a72
[BOT] post-merge updates
OCA-git-bot Sep 24, 2024
55dc3a3
Update translation files
weblate Sep 24, 2024
9fbb33f
[IMP] stock_average_daily_sale: black, isort, prettier
twalter-c2c Sep 24, 2024
3c460e1
[MIG] stock_average_daily_sale: Backporting to 14.0 from 16.0
twalter-c2c Sep 24, 2024
6e5145f
[DON'T MERGE] test-requirements.txt
twalter-c2c Sep 25, 2024
628ee06
stock_average_daily_sale: returns handling
twalter-c2c Nov 4, 2024
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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
freezegun
6 changes: 6 additions & 0 deletions setup/stock_average_daily_sale/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,
)
135 changes: 135 additions & 0 deletions stock_average_daily_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
========================
Stock Average Daily Sale
========================

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

.. |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/14.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-14-0/stock-logistics-reporting-14-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=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to gather stock consumptions and build reporting for average daily
sales (aka stock 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 window you want to analyze.
So, you can define criteria to filter data:

* The Warehouse
* The product ABC classification
* The location kind (Zone, Area, Bin)
* The amount of time to look backward (in days or weeks or months or years)

Moreover, you can define:

* A safety factor
* A standard deviation exclusion factor
* A different root location for analysis per Warehouse

**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 kind (Zone, Area, Bin) - see stock_location_zone module
* The period of time to analyze back (in days/weeks/months/years)
* A standard deviation exclusion factor
* 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 4 hours. You can change
that depending on your needs.

* By default, the root location where analysis is done is the Warehouse stock location,
but you can change it.

* Go to Inventory > Configuration > Warehouses
* Change the 'Average Daily Sale Root Location' field according your needs

Known issues / Roadmap
======================

* Move the filter on saturday/sunday to configuration parameters
* An extensible data gathering query

Changelog
=========

16.0.1.0.0 (2023-01-13)
~~~~~~~~~~~~~~~~~~~~~~~

* [16.0][ADD] stock_average_daily_sale

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:%2014.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 <[email protected]>
* Denis Roussel <[email protected]>
* Jacques-Etienne Baudoux (BCIM) <[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/14.0/stock_average_daily_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_average_daily_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models, wizards
32 changes: 32 additions & 0 deletions stock_average_daily_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 delivered products average on daily basis""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-reporting",
"depends": [
"sale",
"stock_storage_type_putaway_abc",
"stock_location_warehouse", # not needed in Odoo 16.0+
"product_route_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",
"views/stock_warehouse.xml",
"data/ir_cron.xml",
],
"external_dependencies": {"python": ["freezegun"]},
"demo": [
"demo/stock_average_daily_sale_config.xml",
"demo/stock_move.xml",
],
}
16 changes: 16 additions & 0 deletions stock_average_daily_sale/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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">4</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_stock_average_daily_sale" />
<field name="code">model.refresh_view()</field>
<field name="state">code</field>
</record>

</odoo>
47 changes: 47 additions & 0 deletions stock_average_daily_sale/demo/stock_average_daily_sale_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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="standard_deviation_exclude_factor">3</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="standard_deviation_exclude_factor">3</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="standard_deviation_exclude_factor">3</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>
7 changes: 7 additions & 0 deletions stock_average_daily_sale/demo/stock_move.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?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>
Loading
Loading