Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions mrp_warehouse_calendar/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
======================
MRP Warehouse Calendar
======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/15.0/mrp_warehouse_calendar
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_warehouse_calendar
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/129/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

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
lead time, the planned start date of the manufacturing order.

Further manual replannings of start/end date of the manufacturing order
also consider the lead time using the warehouse calendar days.

**Table of contents**

.. contents::
:local:

Configuration
=============

* This module depends on `stock_warehouse_calendar <https://github.com/OCA/stock-logistics-warehouse>`_

* Go to *Settings* and activate the developer mode.

* Go to *Settings > Technical > Resource > Working Time* and define your
resource calendar.

* Go to *Inventory > Configuration > Warehouse Management > Warehouses*
and assign the Resource Calendar.

Usage
=====

When a manufacturing order is created out of a procurement evaluation
(from an orderpoint, MTO,...) the calendar is considered in the computation
of the planned start date of the manufacturing order.

For example, if it takes 1 day to manufacture a product and it is required
for Monday, the manufacturing order will be created with planned start date
on the previous Friday, if the warehouse operates under a Mo-Fri working
calendar.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_warehouse_calendar%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* Jordi Ballester <jordi.ballester@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-JordiBForgeFlow| image:: https://github.com/JordiBForgeFlow.png?size=40px
:target: https://github.com/JordiBForgeFlow
:alt: JordiBForgeFlow

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-JordiBForgeFlow|

This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/15.0/mrp_warehouse_calendar>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mrp_warehouse_calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions mrp_warehouse_calendar/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 ForgeFlow S.L. (https://www.forgeflow.com)
# 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": "16.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/manufacture",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Manufacturing",
"depends": ["mrp", "stock_warehouse_calendar"],
"installable": True,
"development_status": "Production/Stable",
"maintainers": ["JordiBForgeFlow"],
}
31 changes: 31 additions & 0 deletions mrp_warehouse_calendar/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_warehouse_calendar
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2018-12-09 10:43+0000\n"
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.3\n"

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_mrp_production
#, fuzzy
msgid "Production Order"
msgstr "Fertigungsauftrag"

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_stock_rule
msgid "Stock Rule"
msgstr ""

#~ msgid "Procurement Rule"
#~ msgstr "Beschaffungsregel"
24 changes: 24 additions & 0 deletions mrp_warehouse_calendar/i18n/mrp_warehouse_calendar.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_warehouse_calendar
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_mrp_production
msgid "Production Order"
msgstr ""

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_stock_rule
msgid "Stock Rule"
msgstr ""
2 changes: 2 additions & 0 deletions mrp_warehouse_calendar/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mrp_production
from . import stock_rule
43 changes: 43 additions & 0 deletions mrp_warehouse_calendar/models/mrp_production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, models


class MrpProduction(models.Model):
_inherit = "mrp.production"

@api.depends("company_id", "date_planned_start", "is_planned", "product_id")
def _compute_date_planned_finished(self):
res = super(MrpProduction, self)._compute_date_planned_finished()
productions = self.filtered(lambda p: p.date_planned_start and not p.is_planned)
for production in productions:
warehouse = self.picking_type_id.warehouse_id
if warehouse.calendar_id:
if production.product_id.produce_delay:
production.date_planned_finished = warehouse.calendar_id.plan_days(
+1 * production.product_id.produce_delay + 1,
production.date_planned_start,
)
if production.company_id.manufacturing_lead:
production.date_planned_finished = warehouse.calendar_id.plan_days(
+1 * production.company_id.manufacturing_lead + 1,
production.date_planned_finished,
)
production.move_finished_ids = [
(1, m.id, {"date": production.date_planned_finished})
for m in production.move_finished_ids
]
return res

@api.returns("self", lambda value: value.id)
def copy(self, default=None):
mo = super().copy(default=default)
dt_planned = mo.date_planned_start
warehouse = mo.picking_type_id.warehouse_id
if warehouse.calendar_id and mo.product_id.produce_delay:
date_expected = warehouse.calendar_id.plan_days(
+1 * self.product_id.produce_delay + 1, dt_planned
)
mo.date_planned_finished = date_expected
return mo
23 changes: 23 additions & 0 deletions mrp_warehouse_calendar/models/stock_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


class StockRule(models.Model):
_inherit = "stock.rule"

def _get_date_planned(self, product_id, company_id, values):
date_planned = super()._get_date_planned(product_id, company_id, values)
picking_type = self.picking_type_id or values["warehouse_id"].manu_type_id
# 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, dt_planned)
date_planned = date_expected
return date_planned
9 changes: 9 additions & 0 deletions mrp_warehouse_calendar/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* This module depends on `stock_warehouse_calendar <https://github.com/OCA/stock-logistics-warehouse>`_

* Go to *Settings* and activate the developer mode.

* Go to *Settings > Technical > Resource > Working Time* and define your
resource calendar.

* Go to *Inventory > Configuration > Warehouse Management > Warehouses*
and assign the Resource Calendar.
2 changes: 2 additions & 0 deletions mrp_warehouse_calendar/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Jordi Ballester <jordi.ballester@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com>
7 changes: 7 additions & 0 deletions mrp_warehouse_calendar/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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
lead time, the planned start date of the manufacturing order.

Further manual replannings of start/end date of the manufacturing order
also consider the lead time using the warehouse calendar days.
8 changes: 8 additions & 0 deletions mrp_warehouse_calendar/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
When a manufacturing order is created out of a procurement evaluation
(from an orderpoint, MTO,...) the calendar is considered in the computation
of the planned start date of the manufacturing order.

For example, if it takes 1 day to manufacture a product and it is required
for Monday, the manufacturing order will be created with planned start date
on the previous Friday, if the warehouse operates under a Mo-Fri working
calendar.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading