mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[REW] mrp_multi_level_estimate: remove unneeded dependency
Remove unneeded dependency to date_range and relicense to LGPL.
This commit is contained in:
committed by
AlexPForgeFlow
parent
b11ce738bb
commit
893c5b265c
@@ -1,17 +1,17 @@
|
|||||||
# Copyright 2019-22 ForgeFlow S.L. (http://www.forgeflow.com)
|
# Copyright 2019-23 ForgeFlow S.L. (http://www.forgeflow.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).
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "MRP Multi Level Estimate",
|
"name": "MRP Multi Level Estimate",
|
||||||
"version": "15.0.1.0.1",
|
"version": "15.0.1.0.1",
|
||||||
"development_status": "Production/Stable",
|
"development_status": "Production/Stable",
|
||||||
"license": "AGPL-3",
|
"license": "LGPL-3",
|
||||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||||
"maintainers": ["LoisRForgeFlow"],
|
"maintainers": ["LoisRForgeFlow"],
|
||||||
"summary": "Allows to consider demand estimates using MRP multi level.",
|
"summary": "Allows to consider demand estimates using MRP multi level.",
|
||||||
"website": "https://github.com/OCA/manufacture",
|
"website": "https://github.com/OCA/manufacture",
|
||||||
"category": "Manufacturing",
|
"category": "Manufacturing",
|
||||||
"depends": ["mrp_multi_level", "stock_demand_estimate_matrix"],
|
"depends": ["mrp_multi_level", "stock_demand_estimate"],
|
||||||
"data": ["views/product_mrp_area_views.xml", "views/mrp_area_views.xml"],
|
"data": ["views/product_mrp_area_views.xml", "views/mrp_area_views.xml"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"application": False,
|
"application": False,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2022 ForgeFlow S.L. (http://www.forgeflow.com)
|
# Copyright 2022 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||||
# - Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
# - Lois Rilo Antelo <lois.rilo@forgeflow.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
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2019-20 ForgeFlow S.L. (http://www.forgeflow.com)
|
# Copyright 2019-20 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||||
# - Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
# - Lois Rilo Antelo <lois.rilo@forgeflow.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
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
# Copyright 2018-20 ForgeFlow S.L. (http://www.forgeflow.com)
|
# Copyright 2018-22 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from dateutil.rrule import WEEKLY
|
|
||||||
|
|
||||||
from odoo.addons.mrp_multi_level.tests.common import TestMrpMultiLevelCommon
|
from odoo.addons.mrp_multi_level.tests.common import TestMrpMultiLevelCommon
|
||||||
|
|
||||||
|
|
||||||
@@ -39,44 +37,38 @@ class TestMrpMultiLevelEstimate(TestMrpMultiLevelCommon):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create Date Ranges:
|
# Create 3 consecutive estimates of 1 week length each.
|
||||||
cls.dr_type = cls.env["date.range.type"].create(
|
|
||||||
{"name": "Weeks", "company_id": False, "allow_overlap": False}
|
|
||||||
)
|
|
||||||
today = datetime.today().replace(hour=0)
|
today = datetime.today().replace(hour=0)
|
||||||
generator = cls.env["date.range.generator"].create(
|
date_start_1 = today - timedelta(days=3)
|
||||||
{
|
date_end_1 = date_start_1 + timedelta(days=6)
|
||||||
"date_start": today - timedelta(days=3),
|
date_start_2 = date_end_1 + timedelta(days=1)
|
||||||
"name_prefix": "W-",
|
date_end_2 = date_start_2 + timedelta(days=6)
|
||||||
"type_id": cls.dr_type.id,
|
date_start_3 = date_end_2 + timedelta(days=1)
|
||||||
"duration_count": 1,
|
date_end_3 = date_start_3 + timedelta(days=6)
|
||||||
"unit_of_time": str(WEEKLY),
|
start_dates = [date_start_1, date_start_2, date_start_3]
|
||||||
"count": 3,
|
end_dates = [date_end_1, date_end_2, date_end_3]
|
||||||
}
|
|
||||||
)
|
|
||||||
generator.action_apply()
|
|
||||||
cls.date_within_ranges = today - timedelta(days=2)
|
cls.date_within_ranges = today - timedelta(days=2)
|
||||||
cls.date_without_ranges = today + timedelta(days=150)
|
cls.date_without_ranges = today + timedelta(days=150)
|
||||||
|
|
||||||
# Create Demand Estimates:
|
|
||||||
ranges = cls.env["date.range"].search([("type_id", "=", cls.dr_type.id)])
|
|
||||||
qty = 140.0
|
qty = 140.0
|
||||||
for dr in ranges:
|
for sd, ed in zip(start_dates, end_dates):
|
||||||
qty += 70.0
|
qty += 70.0
|
||||||
cls._create_demand_estimate(cls.prod_test, cls.stock_location, dr, qty)
|
cls._create_demand_estimate(cls.prod_test, cls.stock_location, sd, ed, qty)
|
||||||
cls._create_demand_estimate(cls.prod_test, cls.estimate_loc, dr, qty)
|
cls._create_demand_estimate(cls.prod_test, cls.estimate_loc, sd, ed, qty)
|
||||||
|
|
||||||
cls.mrp_multi_level_wiz.create({}).run_mrp_multi_level()
|
cls.mrp_multi_level_wiz.create({}).run_mrp_multi_level()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_demand_estimate(cls, product, location, date_range, qty):
|
def _create_demand_estimate(cls, product, location, date_from, date_to, qty):
|
||||||
cls.estimate_obj.create(
|
cls.estimate_obj.create(
|
||||||
{
|
{
|
||||||
"product_id": product.id,
|
"product_id": product.id,
|
||||||
"location_id": location.id,
|
"location_id": location.id,
|
||||||
"product_uom": product.uom_id.id,
|
"product_uom": product.uom_id.id,
|
||||||
"product_uom_qty": qty,
|
"product_uom_qty": qty,
|
||||||
"date_range_id": date_range.id,
|
"manual_date_from": date_from,
|
||||||
|
"manual_date_to": date_to,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2019-22 ForgeFlow S.L. (http://www.forgeflow.com)
|
# Copyright 2019-22 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||||
# - Lois Rilo <lois.rilo@forgeflow.com>
|
# - Lois Rilo <lois.rilo@forgeflow.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).
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|||||||
Reference in New Issue
Block a user