Skip to content

Commit

Permalink
[MIG] stock_demand_estimate_matrix: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-tubtim authored and kaynnan committed Jul 15, 2023
1 parent 9cb39fa commit 04b3362
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 45 deletions.
21 changes: 11 additions & 10 deletions stock_demand_estimate_matrix/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Stock Demand Estimate Matrix
: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
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.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
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-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
:target: https://runbot.odoo-community.org/runbot/153/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -41,19 +41,19 @@ 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
Github: https://github.com/OCA/web/tree/13.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
Github: https://github.com/OCA/server-ux/tree/13.0/date_range

Usage
=====

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

Go to 'Inventory / Demand Planning / Create Demand Estimates' to create or
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
Go to *Inventory > Demand Planning > Demand Estimates* to review the
estimates created.

Bug Tracker
Expand All @@ -62,7 +62,7 @@ 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**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_demand_estimate_matrix%0Aversion:%2013.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.

Expand All @@ -79,6 +79,7 @@ Contributors

* Jordi Ballester Alomar <[email protected]>
* Lois Rilo <[email protected]>
* Pimolnat Suntian <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -93,6 +94,6 @@ 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.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_demand_estimate_matrix>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 0 additions & 1 deletion stock_demand_estimate_matrix/models/date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class DateRange(models.Model):
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):
Expand Down
2 changes: 0 additions & 2 deletions stock_demand_estimate_matrix/models/stock_demand_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class StockDemandEstimate(models.Model):
comodel_name="date.range", string="Estimating Period", ondelete="restrict"
)

@api.multi
@api.depends(
"date_range_id", "manual_duration", "manual_date_from", "manual_date_to",
)
Expand All @@ -24,7 +23,6 @@ def _compute_dates(self):
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()
Expand Down
1 change: 1 addition & 0 deletions stock_demand_estimate_matrix/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* Jordi Ballester Alomar <[email protected]>
* Lois Rilo <[email protected]>
* Pimolnat Suntian <[email protected]>
4 changes: 2 additions & 2 deletions stock_demand_estimate_matrix/readme/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,6 +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
Github: https://github.com/OCA/web/tree/13.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
Github: https://github.com/OCA/server-ux/tree/13.0/date_range
6 changes: 3 additions & 3 deletions stock_demand_estimate_matrix/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Go to 'Inventory / Configuration / Date Ranges' and define your estimating periods.
Go to *Inventory > Configuration > Date Ranges* and define your estimating periods.

Go to 'Inventory / Demand Planning / Create Demand Estimates' to create or
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
Go to *Inventory > Demand Planning > Demand Estimates* to review the
estimates created.
17 changes: 9 additions & 8 deletions stock_demand_estimate_matrix/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Stock Demand Estimate Matrix</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_demand_estimate_matrix"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_demand_estimate_matrix"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_demand_estimate_matrix"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_demand_estimate_matrix"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to create demand estimates for a given product and
location, on configurable time periods.</p>
<p>The module does not provide in itself any specific usage of the estimates.</p>
Expand All @@ -390,25 +390,25 @@ <h1><a class="toc-backref" href="#id1">Installation</a></h1>
<p>This module relies on:</p>
<ul class="simple">
<li>The OCA module ‘2D matrix for x2many fields’, and can be downloaded from
Github: <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_widget_x2many_2d_matrix">https://github.com/OCA/web/tree/12.0/web_widget_x2many_2d_matrix</a></li>
Github: <a class="reference external" href="https://github.com/OCA/web/tree/13.0/web_widget_x2many_2d_matrix">https://github.com/OCA/web/tree/13.0/web_widget_x2many_2d_matrix</a></li>
<li>The OCA module ‘Date Range’, and can be downloaded from
Github: <a class="reference external" href="https://github.com/OCA/server-ux/tree/12.0/date_range">https://github.com/OCA/server-ux/tree/12.0/date_range</a></li>
Github: <a class="reference external" href="https://github.com/OCA/server-ux/tree/13.0/date_range">https://github.com/OCA/server-ux/tree/13.0/date_range</a></li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<p>Go to Inventory / Configuration / Date Ranges and define your estimating periods.</p>
<p>Go to Inventory / Demand Planning / Create Demand Estimates to create or
<p>Go to <em>Inventory &gt; Configuration &gt; Date Ranges</em> and define your estimating periods.</p>
<p>Go to <em>Inventory &gt; Demand Planning &gt; Create Demand Estimates</em> to create or
update your demand estimates.</p>
<p>Go to Inventory / Demand Planning / Demand Estimates to review the
<p>Go to <em>Inventory &gt; Demand Planning &gt; Demand Estimates</em> to review the
estimates created.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
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
<a class="reference external" href="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**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_demand_estimate_matrix%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -424,6 +424,7 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Jordi Ballester Alomar &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -433,7 +434,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_demand_estimate_matrix">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_demand_estimate_matrix">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ def setUpClass(cls):
{"name": "Month", "allow_overlap": False}
)

generator = cls.env["date.range.generator"]
generator = generator.create(
generator = cls.env["date.range.generator"].create(
{
"date_start": "1943-01-01",
"name_prefix": "1943-",
"type_id": cls.drt_monthly.id,
"duration_count": 1,
"unit_of_time": MONTHLY,
"unit_of_time": str(MONTHLY),
"count": 12,
}
)
Expand Down Expand Up @@ -176,7 +175,7 @@ def test_03_computed_fields(self):
{
"product_id": self.product_1.id,
"location_id": self.location.id,
"date_range_id": range.id,
"date_range_id": date_range.id,
"product_uom_qty": 100.0,
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression

from odoo.addons import decimal_precision as dp


class StockDemandEstimateSheet(models.TransientModel):
_name = "stock.demand.estimate.sheet"
Expand Down Expand Up @@ -126,7 +124,6 @@ def _prepare_estimate_data(self, line):
"product_uom": line.product_id.uom_id.id,
}

@api.multi
def button_validate(self):
res = []
for line in self.line_ids:
Expand Down Expand Up @@ -154,16 +151,15 @@ class StockDemandEstimateSheetLine(models.TransientModel):
_description = "Stock Demand Estimate Sheet Line"

estimate_id = fields.Many2one(comodel_name="stock.demand.estimate")
date_range_id = fields.Many2one(comodel_name="date.range", string="Period",)
date_range_id = fields.Many2one(comodel_name="date.range", string="Period")
location_id = fields.Many2one(
comodel_name="stock.location", string="Stock Location",
)
product_id = fields.Many2one(comodel_name="product.product", string="Product",)
value_x = fields.Char(string="Period Name",)
value_y = fields.Char(string="Product Name",)
product_uom_qty = fields.Float(
string="Quantity", digits=dp.get_precision("Product UoM"),
comodel_name="stock.location", string="Stock Location"
)
product_id = fields.Many2one(comodel_name="product.product", string="Product")
value_x = fields.Char(string="Period Name")
value_y = fields.Char(string="Product Name")
product_uom = fields.Many2one(comodel_name="uom.uom", string="Unit of measure")
product_uom_qty = fields.Float(string="Quantity", digits="Product UoM")


class DemandEstimateWizard(models.TransientModel):
Expand Down Expand Up @@ -200,7 +196,6 @@ def _check_start_end_dates(self):
_("The start date cannot be later than the end date.")
)

@api.multi
def _prepare_demand_estimate_sheet(self):
self.ensure_one()
return {
Expand All @@ -210,7 +205,6 @@ def _prepare_demand_estimate_sheet(self):
"location_id": self.location_id.id,
}

@api.multi
def create_sheet(self):
self.ensure_one()
if not self.product_ids:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@
<act_window
name="Create Stock Demand Estimates"
res_model="stock.demand.estimate.wizard"
src_model="stock.demand.estimate.sheet"
binding_model="stock.demand.estimate.sheet"
view_mode="form"
target="new"
key2="client_action_multi"
id="stock_demand_estimate_wizard_action"
/>
<menuitem
Expand Down

0 comments on commit 04b3362

Please sign in to comment.