Skip to content

Commit

Permalink
[12.0][ADD] stock_demand_estimate_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisRForgeFlow authored and kaynnan committed Jul 15, 2023
1 parent 28d5065 commit f077862
Show file tree
Hide file tree
Showing 19 changed files with 1,258 additions and 0 deletions.
98 changes: 98 additions & 0 deletions stock_demand_estimate_matrix/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
============================
Stock Demand Estimate Matrix
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_demand_estimate_matrix
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_demand_estimate_matrix
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/12.0
:alt: Try me on Runbot

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

This module allows to create demand estimates for a given product and
location, on configurable time periods.

The module does not provide in itself any specific usage of the estimates.

**Table of contents**

.. contents::
:local:

Installation
============

This module relies on:

* The OCA module '2D matrix for x2many fields', and can be downloaded from
Github: https://github.com/OCA/web/tree/12.0/web_widget_x2many_2d_matrix
* The OCA module 'Date Range', and can be downloaded from
Github: https://github.com/OCA/server-ux/tree/12.0/date_range

Usage
=====

Go to 'Inventory / Configuration / Date Ranges' and define your estimating periods.

Go to 'Inventory / Demand Planning / Create Demand Estimates' to create or
update your demand estimates.

Go to 'Inventory / Demand Planning / Demand Estimates' to review the
estimates created.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_demand_estimate_matrix%0Aversion:%2012.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
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* Jordi Ballester Alomar <[email protected]>
* Lois Rilo <[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-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_demand_estimate_matrix>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions stock_demand_estimate_matrix/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
22 changes: 22 additions & 0 deletions stock_demand_estimate_matrix/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Demand Estimate Matrix",
"summary": "Allows to create demand estimates.",
"version": "12.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"depends": [
"stock_demand_estimate",
"web_widget_x2many_2d_matrix",
"date_range",
],
"data": [
"views/stock_demand_estimate_view.xml",
"views/date_range.xml",
"wizards/stock_demand_estimate_wizard_view.xml",
],
"license": "AGPL-3",
"installable": True,
}
2 changes: 2 additions & 0 deletions stock_demand_estimate_matrix/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_demand_estimate
from . import date_range
23 changes: 23 additions & 0 deletions stock_demand_estimate_matrix/models/date_range.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class DateRange(models.Model):
_inherit = "date.range"

days = fields.Integer(
string="Days between dates",
compute="_compute_days",
readonly=True,
)

@api.multi
@api.depends("date_start", "date_end")
def _compute_days(self):
for rec in self.filtered(lambda x: x.date_start and x.date_end):
rec.days = abs((
rec.date_end -
rec.date_start
).days) + 1
40 changes: 40 additions & 0 deletions stock_demand_estimate_matrix/models/stock_demand_estimate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class StockDemandEstimate(models.Model):
_inherit = 'stock.demand.estimate'

date_range_id = fields.Many2one(
comodel_name="date.range",
string="Estimating Period",
ondelete='restrict'
)

@api.multi
@api.depends(
"date_range_id", "manual_duration", "manual_date_from", "manual_date_to",
)
def _compute_dates(self):
date_range_records = self.filtered(lambda r: r.date_range_id)
res = super(
StockDemandEstimate, self - date_range_records)._compute_dates()
for rec in date_range_records:
rec.date_from = rec.date_range_id.date_start
rec.date_to = rec.date_range_id.date_end
rec.duration = rec.date_range_id.days
return res

@api.multi
def name_get(self):
date_range_records = self.filtered(lambda r: r.date_range_id)
res = super(StockDemandEstimate, self - date_range_records).name_get()
for rec in date_range_records:
name = "%s - %s - %s" % (
rec.date_range_id.name, rec.product_id.name,
rec.location_id.name,
)
res.append((rec.id, name))
return res
2 changes: 2 additions & 0 deletions stock_demand_estimate_matrix/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Jordi Ballester Alomar <[email protected]>
* Lois Rilo <[email protected]>
4 changes: 4 additions & 0 deletions stock_demand_estimate_matrix/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module allows to create demand estimates for a given product and
location, on configurable time periods.

The module does not provide in itself any specific usage of the estimates.
6 changes: 6 additions & 0 deletions stock_demand_estimate_matrix/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module relies on:

* The OCA module '2D matrix for x2many fields', and can be downloaded from
Github: https://github.com/OCA/web/tree/12.0/web_widget_x2many_2d_matrix
* The OCA module 'Date Range', and can be downloaded from
Github: https://github.com/OCA/server-ux/tree/12.0/date_range
7 changes: 7 additions & 0 deletions stock_demand_estimate_matrix/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Go to 'Inventory / Configuration / Date Ranges' and define your estimating periods.

Go to 'Inventory / Demand Planning / Create Demand Estimates' to create or
update your demand estimates.

Go to 'Inventory / Demand Planning / Demand Estimates' to review the
estimates created.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f077862

Please sign in to comment.