[12.0][MIG] mrp_multi_level:

* You can know integrate with different forecasting mechanisms.
  As a consequence integration with stock_demand_estimate is moved
  to a new module (mrp_multi_level_estimate).
* As agreed by the authors, the module is re-licensed to LGPL-3.
This commit is contained in:
Lois Rilo
2019-08-05 13:53:12 +02:00
committed by davidborromeo
parent 33ae366abf
commit dce2682fdc
25 changed files with 473 additions and 537 deletions

View File

@@ -2,7 +2,7 @@
# Copyright 2016-19 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar <jordi.ballester@eficent.com>
# - Lois Rilo Antelo <lois.rilo@eficent.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
@@ -34,7 +34,7 @@ class MrpInventory(models.Model):
store=True,
)
uom_id = fields.Many2one(
comodel_name='product.uom', string='Product UoM',
comodel_name='uom.uom', string='Product UoM',
compute='_compute_uom_id',
)
date = fields.Date(string='Date')
@@ -84,9 +84,11 @@ class MrpInventory(models.Model):
for rec in self.filtered(lambda r: r.date):
delay = rec.product_mrp_area_id.mrp_lead_time
if delay and rec.mrp_area_id.calendar_id:
dt_date = fields.Datetime.from_string(rec.date)
dt_date = fields.Datetime.to_datetime(rec.date)
# dt_date is at the beginning of the day (00:00),
# so we can subtract the delay straight forward.
order_release_date = rec.mrp_area_id.calendar_id.plan_days(
-delay - 1, dt_date).date()
-delay, dt_date).date()
else:
order_release_date = fields.Date.from_string(
rec.date) - timedelta(days=delay)