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
@@ -23,7 +23,7 @@ MRP Multi Level Estimate
|
||||
:target: https://runbot.odoo-community.org/runbot/129/15.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
Integration for MRP Multi Level and `Stock Demand Estimates <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_demand_estimate>`_ system.
|
||||
|
||||
@@ -84,7 +84,7 @@ promote its widespread use.
|
||||
|
||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-LoisRForgeFlow|
|
||||
|maintainer-LoisRForgeFlow|
|
||||
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/15.0/mrp_multi_level_estimate>`_ project on GitHub.
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# Copyright 2019-22 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/Agpl.html).
|
||||
# Copyright 2019-23 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
{
|
||||
"name": "MRP Multi Level Estimate",
|
||||
"version": "15.0.1.0.1",
|
||||
"development_status": "Production/Stable",
|
||||
"license": "AGPL-3",
|
||||
"license": "LGPL-3",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"maintainers": ["LoisRForgeFlow"],
|
||||
"summary": "Allows to consider demand estimates using MRP multi level.",
|
||||
"website": "https://github.com/OCA/manufacture",
|
||||
"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"],
|
||||
"installable": True,
|
||||
"application": False,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copyright 2022 ForgeFlow S.L. (http://www.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
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copyright 2019-20 ForgeFlow S.L. (http://www.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
|
||||
|
||||
|
||||
@@ -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).
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from dateutil.rrule import WEEKLY
|
||||
|
||||
from odoo.addons.mrp_multi_level.tests.common import TestMrpMultiLevelCommon
|
||||
|
||||
|
||||
@@ -39,44 +37,38 @@ class TestMrpMultiLevelEstimate(TestMrpMultiLevelCommon):
|
||||
}
|
||||
)
|
||||
|
||||
# Create Date Ranges:
|
||||
cls.dr_type = cls.env["date.range.type"].create(
|
||||
{"name": "Weeks", "company_id": False, "allow_overlap": False}
|
||||
)
|
||||
# Create 3 consecutive estimates of 1 week length each.
|
||||
today = datetime.today().replace(hour=0)
|
||||
generator = cls.env["date.range.generator"].create(
|
||||
{
|
||||
"date_start": today - timedelta(days=3),
|
||||
"name_prefix": "W-",
|
||||
"type_id": cls.dr_type.id,
|
||||
"duration_count": 1,
|
||||
"unit_of_time": str(WEEKLY),
|
||||
"count": 3,
|
||||
}
|
||||
)
|
||||
generator.action_apply()
|
||||
date_start_1 = today - timedelta(days=3)
|
||||
date_end_1 = date_start_1 + timedelta(days=6)
|
||||
date_start_2 = date_end_1 + timedelta(days=1)
|
||||
date_end_2 = date_start_2 + timedelta(days=6)
|
||||
date_start_3 = date_end_2 + timedelta(days=1)
|
||||
date_end_3 = date_start_3 + timedelta(days=6)
|
||||
start_dates = [date_start_1, date_start_2, date_start_3]
|
||||
end_dates = [date_end_1, date_end_2, date_end_3]
|
||||
|
||||
cls.date_within_ranges = today - timedelta(days=2)
|
||||
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
|
||||
for dr in ranges:
|
||||
for sd, ed in zip(start_dates, end_dates):
|
||||
qty += 70.0
|
||||
cls._create_demand_estimate(cls.prod_test, cls.stock_location, dr, qty)
|
||||
cls._create_demand_estimate(cls.prod_test, cls.estimate_loc, 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, sd, ed, qty)
|
||||
|
||||
cls.mrp_multi_level_wiz.create({}).run_mrp_multi_level()
|
||||
|
||||
@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(
|
||||
{
|
||||
"product_id": product.id,
|
||||
"location_id": location.id,
|
||||
"product_uom": product.uom_id.id,
|
||||
"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)
|
||||
# - 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
|
||||
from datetime import timedelta
|
||||
|
||||
Reference in New Issue
Block a user