[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 JasminSForgeFlow
parent 511f020109
commit d750aae31b
25 changed files with 473 additions and 537 deletions

View File

@@ -2,13 +2,14 @@
# © 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
class MrpArea(models.Model):
_name = 'mrp.area'
_description = "MRP Area"
name = fields.Char(required=True)
warehouse_id = fields.Many2one(

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)

View File

@@ -1,19 +1,21 @@
# © 2016 Ucamco - Wim Audenaert <wim.audenaert@ucamco.com>
# © 2016-18 Eficent Business and IT Consulting Services S.L.
# 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 models, fields
class MrpMove(models.Model):
_name = 'mrp.move'
_description = "MRP Move"
_order = 'product_mrp_area_id, mrp_date, mrp_type desc, id'
# TODO: too many indexes...
product_mrp_area_id = fields.Many2one(
comodel_name="product.mrp.area",
string="Product", index=True,
string="Product MRP Area",
index=True,
required=True,
)
mrp_area_id = fields.Many2one(

View File

@@ -1,6 +1,6 @@
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# - 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 models, fields
@@ -13,7 +13,7 @@ class MrpPlannedOrder(models.Model):
name = fields.Char(string="Description")
product_mrp_area_id = fields.Many2one(
comodel_name="product.mrp.area",
string="Product",
string="Product MRP Area",
index=True,
required=True,
)
@@ -52,7 +52,9 @@ class MrpPlannedOrder(models.Model):
mrp_action = fields.Selection(
selection=[("manufacture", "Manufacturing Order"),
("buy", "Purchase Order"),
("move", "Transfer"),
('pull', 'Pull From'),
('push', 'Push To'),
('pull_push', 'Pull & Push'),
("none", "None")],
string="Action",
)

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 math import ceil
@@ -80,11 +80,12 @@ class ProductMRPArea(models.Model):
selection=[('buy', 'Buy'),
('none', 'Undefined'),
('manufacture', 'Produce'),
('move', 'Transfer')],
('pull', 'Pull From'),
('push', 'Push To'),
('pull_push', 'Pull & Push')],
string='Supply Method',
compute='_compute_supply_method',
)
qty_available = fields.Float(
string="Quantity Available",
compute="_compute_qty_available",
@@ -99,10 +100,7 @@ class ProductMRPArea(models.Model):
inverse_name="product_mrp_area_id",
readonly=True,
)
group_estimate_days = fields.Integer(
string="Group Days of Estimates",
default=1,
)
_sql_constraints = [
('product_mrp_area_uniq', 'unique(product_id, mrp_area_id)',
'The product/MRP Area parameters combination must be unique.'),
@@ -111,13 +109,12 @@ class ProductMRPArea(models.Model):
@api.multi
@api.constrains(
"mrp_minimum_order_qty", "mrp_maximum_order_qty", "mrp_qty_multiple",
"mrp_minimum_stock", "mrp_nbr_days", "group_estimate_days",
"mrp_minimum_stock", "mrp_nbr_days",
)
def _check_negatives(self):
values = self.read([
"mrp_minimum_order_qty", "mrp_maximum_order_qty",
"mrp_qty_multiple",
"mrp_minimum_stock", "mrp_nbr_days", "group_estimate_days",
"mrp_qty_multiple", "mrp_minimum_stock", "mrp_nbr_days",
])
for rec in values:
if any(v < 0 for v in rec.values()):

View File

@@ -1,6 +1,6 @@
# Copyright 2016 Ucamco - Wim Audenaert <wim.audenaert@ucamco.com>
# Copyright 2016-18 Eficent Business and IT Consulting Services S.L.
# 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).
import ast
from odoo import api, fields, models

View File

@@ -1,5 +1,5 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# 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).
import ast
from odoo import api, fields, models

View File

@@ -1,7 +1,7 @@
# © 2016 Ucamco - Wim Audenaert <wim.audenaert@ucamco.com>
# © 2016 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar <jordi.ballester@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 fields, models