Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mrp_warehouse_calendar: Migration to 18.0 #1395

Merged
merged 28 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d47cc4a
11.0 add mrp_warehouse_calendar
JordiBForgeFlow Jun 29, 2018
09ceb34
[FIX] remove empty file to make readme generator work properly
LoisRForgeFlow Jul 6, 2018
08c1313
[MIG] mrp_warehouse_calendar: Migration to 12.0
Saran440 Aug 5, 2018
845c9e0
[12.0] mrp_warehouse_calendar:
LoisRForgeFlow Jul 31, 2019
d74f949
mrp_warehouse_calendar 12.0.1.0.1
OCA-git-bot Jul 31, 2019
61d9bc2
[IMP] mrp_warehouse_calendar: black, isort
LoisRForgeFlow Dec 17, 2019
4d0e555
[13.0][MIG] mrp_warehouse_calendar
LoisRForgeFlow Dec 17, 2019
e57d92d
Update translation files
oca-transbot Nov 22, 2020
eb0877b
[IMP] mrp_warehouse_calendar: black, isort, prettier
DavidBForgeFlow Jan 29, 2021
b6642d3
[MIG] mrp_warehouse_calendar: Migration to 14.0
DavidBForgeFlow Jan 29, 2021
b7cedfb
[MIG] mrp_warehouse_calendar: Migration to 15.0
JoanMForgeFlow Oct 26, 2021
e9487ce
[UPD] Update mrp_warehouse_calendar.pot
Oct 29, 2021
8518625
[UPD] README.rst
OCA-git-bot Oct 29, 2021
3fada39
[FIX] mrp_warehouse_calendar: date_planned_finished calculated with w…
BernatPForgeFlow Feb 2, 2022
595c919
mrp_warehouse_calendar 15.0.1.0.1
OCA-git-bot Jul 21, 2022
065c117
[MIG] mrp_warehouse_calendar: Migration to 16.0
JoanSForgeFlow Nov 11, 2022
4ad4e68
[UPD] Update mrp_warehouse_calendar.pot
Nov 18, 2022
030b764
[UPD] README.rst
OCA-git-bot Nov 18, 2022
165885d
Added translation using Weblate (Italian)
mymage Jun 23, 2023
660483a
Translated using Weblate (Italian)
mymage Jun 23, 2023
cfc5a9c
Added translation using Weblate (Spanish)
Ivorra78 Jul 10, 2023
87ec06c
Translated using Weblate (Spanish)
Ivorra78 Jul 10, 2023
98fb390
[UPD] README.rst
OCA-git-bot Sep 3, 2023
006700e
[IMP] mrp_warehouse_calendar: black, isort, prettier
JasminSForgeFlow Mar 12, 2024
9f0f7e5
[MIG] mrp_warehouse_calendar: Migration to 17.0
JasminSForgeFlow Mar 12, 2024
6e3b956
[UPD] Update mrp_warehouse_calendar.pot
Mar 25, 2024
f178e4b
[BOT] post-merge updates
OCA-git-bot Mar 25, 2024
7d6fc6f
[MIG] mrp_warehouse_calendar: Migration to 18.0
RicardCForgeFlow Nov 13, 2024
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
130 changes: 130 additions & 0 deletions mrp_warehouse_calendar/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
======================
MRP Warehouse Calendar
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:18cdb9aea24afa77c86c9bf4c578ce490415389ba52053aabd18c04b457002eb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.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-18-0/manufacture-18-0-mrp_warehouse_calendar
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=18.0
:alt: Try me on Runboat

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

This module ensures that manufacturing orders created from procurements
respect the calendar assigned to the warehouse associated with the
manufacturing order's picking type. The planned start date of the
manufacturing order is calculated based on the product's manufacturing
lead time and the working schedules defined in the warehouse calendar.

Additionally, any manual rescheduling of the start or end date of a
manufacturing order will also take the lead time into account, following
the working days defined by the warehouse calendar.

**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. |Developer mode|
- Go to *Settings > Technical > Resource > Working Schedules* and
define your resource calendar. |Working Schedules|
- Go to *Inventory > Configuration > Warehouse Management > Warehouses*
and assign the Working Schedule. |Warehouse Management|

.. |Developer mode| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/developer_mode.gif
.. |Working Schedules| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/working_schedules.gif
.. |Warehouse Management| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/warehouse_management.gif

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: |Replenish|

the manufacturing order will be created with planned start date on the
previous Friday, if the warehouse operates under a Mo-Fri working
calendar. |Manufacturing Order|

Manual changes to the start or end date of a manufacturing order will
also respect the lead time and the warehouse calendar's working days.
|Manual change day|

.. |Replenish| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/replenish.png
.. |Manufacturing Order| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/manufacturing_order.png
.. |Manual change day| image:: https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/change_day.gif

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_warehouse_calendar%0Aversion:%2018.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/18.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": "18.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"
27 changes: 27 additions & 0 deletions mrp_warehouse_calendar/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_warehouse_calendar
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-10 10:08+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\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 4.17\n"

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_mrp_production
msgid "Production Order"
msgstr "Orden de Producción"

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_stock_rule
msgid "Stock Rule"
msgstr "Regla de existencias"
27 changes: 27 additions & 0 deletions mrp_warehouse_calendar/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_warehouse_calendar
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-23 13:09+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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 4.17\n"

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

#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_stock_rule
msgid "Stock Rule"
msgstr "Regola di giacenza"
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 17.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
49 changes: 49 additions & 0 deletions mrp_warehouse_calendar/models/mrp_production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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_start",
"is_planned",
"product_id",
"workorder_ids.duration_expected",
)
def _compute_date_finished(self):
res = super()._compute_date_finished()
productions = self.filtered(lambda p: p.date_start and not p.is_planned)
for production in productions:
warehouse = self.picking_type_id.warehouse_id
if warehouse.calendar_id:
if production.bom_id.produce_delay:
production.date_finished = warehouse.calendar_id.plan_days(
+1 * production.bom_id.produce_delay + 1,
production.date_start,
)
if production.company_id.manufacturing_lead:
production.date_finished = warehouse.calendar_id.plan_days(
+1 * production.company_id.manufacturing_lead + 1,
production.date_finished,
)
production.move_finished_ids = [
(1, m.id, {"date": production.date_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_start
warehouse = mo.picking_type_id.warehouse_id
if warehouse.calendar_id and mo.bom_id.produce_delay:
date_expected = warehouse.calendar_id.plan_days(
+1 * self.bom_id.produce_delay + 1, dt_planned
)
mo.date_finished = date_expected
return mo
21 changes: 21 additions & 0 deletions mrp_warehouse_calendar/models/stock_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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, bom_id, values):
date_planned = super()._get_date_planned(bom_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 bom_id.produce_delay:
lead_days = values["company_id"].manufacturing_lead + bom_id.produce_delay
date_expected = warehouse.calendar_id.plan_days(-1 * lead_days, dt_planned)
date_planned = date_expected
return date_planned
3 changes: 3 additions & 0 deletions mrp_warehouse_calendar/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
10 changes: 10 additions & 0 deletions mrp_warehouse_calendar/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- This module depends on
[stock_warehouse_calendar](https://github.com/OCA/stock-logistics-warehouse)
- Go to *Settings* and activate the developer mode.
![Developer mode](../static/description/developer_mode.gif)
- Go to *Settings \> Technical \> Resource \> Working Schedules* and define
your resource calendar.
![Working Schedules](../static/description/working_schedules.gif)
- Go to *Inventory \> Configuration \> Warehouse Management \>
Warehouses* and assign the Working Schedule.
![Warehouse Management](../static/description/warehouse_management.gif)
2 changes: 2 additions & 0 deletions mrp_warehouse_calendar/readme/CONTRIBUTORS.md
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>\>
11 changes: 11 additions & 0 deletions mrp_warehouse_calendar/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This module ensures that manufacturing orders created from
procurements respect the calendar assigned to the warehouse
associated with the manufacturing order's picking type.
The planned start date of the manufacturing order is calculated
based on the product's manufacturing lead time and the working
schedules defined in the warehouse calendar.

Additionally, any manual rescheduling of the start or
end date of a manufacturing order will also take the lead
time into account, following the working days defined by
the warehouse calendar.
16 changes: 16 additions & 0 deletions mrp_warehouse_calendar/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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:
![Replenish](../static/description/replenish.png)

the manufacturing order will be created with
planned start date on the previous Friday, if the warehouse operates
under a Mo-Fri working calendar.
![Manufacturing Order](../static/description/manufacturing_order.png)

Manual changes to the start or end date of a manufacturing order will
also respect the lead time and the warehouse calendar's working days.
![Manual change day](../static/description/change_day.gif)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading