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..c910d3974 100644 --- a/mrp_warehouse_calendar/static/description/index.html +++ b/mrp_warehouse_calendar/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

With this module the manufacturing orders created from procurements consider the calendar assigned to the warehouse of the picking type of the manufacturing order to determine, based on the product’s manufacturing diff --git a/mrp_warehouse_calendar/tests/test_mrp_warehouse_calendar.py b/mrp_warehouse_calendar/tests/test_mrp_warehouse_calendar.py index c57c1c5c2..5df2b6975 100644 --- a/mrp_warehouse_calendar/tests/test_mrp_warehouse_calendar.py +++ b/mrp_warehouse_calendar/tests/test_mrp_warehouse_calendar.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 fields from odoo.tests.common import TransactionCase @@ -70,6 +70,28 @@ class TestMrpWarehouseCalendar(TransactionCase): self.assertEqual(date_plan_start, friday) + def test_procurement_with_calendar_02(self): + """Test procuring at the beginning of the day, with no work intervals + before.""" + values = { + 'date_planned': '2097-01-07 01:00:00', # Monday + 'warehouse_id': self.warehouse, + 'company_id': self.company, + 'rule_id': self.manufacture_route, + } + self.env['procurement.group'].run( + self.product, 100, + self.product.uom_id, + self.warehouse.lot_stock_id, 'Test 2', + 'Test 2', values) + mo = self.env['mrp.production'].search( + [('product_id', '=', self.product.id)], limit=1) + date_plan_start = fields.Date.to_date(mo.date_planned_start) + # Friday 4th Jan 2097 + friday = fields.Date.to_date('2097-01-04 09:00:00') + + self.assertEqual(date_plan_start, friday) + def test_onchange_date_planned(self): mo = self.env['mrp.production'].new({ 'product_id': self.product.id,