From cc01c9f92b8049185b50bc6fc1b2a82e15dcaaa1 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 31 Jul 2019 12:22:13 +0200 Subject: [PATCH] [12.0] mrp_warehouse_calendar: * fix error calculating the planned date depending on the hour. * relicense to lgpl to allow broader use in customizations. --- mrp_warehouse_calendar/README.rst | 6 ++--- mrp_warehouse_calendar/__manifest__.py | 4 ++-- .../models/mrp_production.py | 2 +- mrp_warehouse_calendar/models/stock_rule.py | 11 +++++---- .../static/description/index.html | 4 ++-- .../tests/test_mrp_warehouse_calendar.py | 24 ++++++++++++++++++- 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/mrp_warehouse_calendar/README.rst b/mrp_warehouse_calendar/README.rst index 889c286ac..994ca9716 100644 --- a/mrp_warehouse_calendar/README.rst +++ b/mrp_warehouse_calendar/README.rst @@ -10,9 +10,9 @@ MRP Warehouse Calendar .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github :target: https://github.com/OCA/manufacture/tree/12.0/mrp_warehouse_calendar :alt: OCA/manufacture diff --git a/mrp_warehouse_calendar/__manifest__.py b/mrp_warehouse_calendar/__manifest__.py index 264b6cffb..4f3200a91 100644 --- a/mrp_warehouse_calendar/__manifest__.py +++ b/mrp_warehouse_calendar/__manifest__.py @@ -1,11 +1,11 @@ # 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). { "name": "MRP Warehouse Calendar", "summary": "Considers the warehouse calendars in manufacturing", "version": "12.0.1.0.0", - "license": "AGPL-3", + "license": "LGPL-3", "website": "https://github.com/stock-logistics-warehouse", "author": "Eficent, " "Odoo Community Association (OCA)", diff --git a/mrp_warehouse_calendar/models/mrp_production.py b/mrp_warehouse_calendar/models/mrp_production.py index 46764ee40..373bd8c75 100644 --- a/mrp_warehouse_calendar/models/mrp_production.py +++ b/mrp_warehouse_calendar/models/mrp_production.py @@ -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). from odoo import api, models diff --git a/mrp_warehouse_calendar/models/stock_rule.py b/mrp_warehouse_calendar/models/stock_rule.py index 84a93d8dd..a493b6784 100644 --- a/mrp_warehouse_calendar/models/stock_rule.py +++ b/mrp_warehouse_calendar/models/stock_rule.py @@ -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). +# Copyright 2018-19 Eficent Business and IT Consulting Services, S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import fields, models @@ -12,12 +12,15 @@ class StockRule(models.Model): product_id, values) picking_type = self.picking_type_id or \ values['warehouse_id'].manu_type_id - dt_planned = fields.Datetime.to_datetime(values['date_planned']) + # We force the date planned to be at the beginning of the day. + # So no work intervals are found in planned date. + dt_planned = fields.Datetime.to_datetime( + values['date_planned']).replace(hour=0) warehouse = picking_type.warehouse_id if warehouse.calendar_id and product_id.produce_delay: lead_days = values['company_id'].manufacturing_lead + \ product_id.produce_delay date_expected = warehouse.calendar_id.plan_days( - -1 * lead_days - 1, dt_planned) + -1 * lead_days, dt_planned) date_planned = date_expected return date_planned diff --git a/mrp_warehouse_calendar/static/description/index.html b/mrp_warehouse_calendar/static/description/index.html index b3fd8b1cc..3f5bcb9cd 100644 --- a/mrp_warehouse_calendar/static/description/index.html +++ b/mrp_warehouse_calendar/static/description/index.html @@ -3,7 +3,7 @@ - + MRP Warehouse Calendar