[MIG] mrp_warehouse_calendar: Migration to 18.0

This commit is contained in:
RicardCForgeFlow
2024-11-13 17:01:18 +01:00
parent f178e4b6fe
commit 7d6fc6f6fc
13 changed files with 110 additions and 57 deletions

View File

@@ -17,25 +17,26 @@ MRP Warehouse Calendar
: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/17.0/mrp_warehouse_calendar
: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-17-0/manufacture-17-0-mrp_warehouse_calendar
: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=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=18.0
:alt: Try me on Runboat
|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.
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.
Further manual replannings of start/end date of the manufacturing order
also consider the lead time using the warehouse calendar days.
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**
@@ -47,11 +48,15 @@ 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 *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 Resource Calendar.
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
=====
@@ -61,9 +66,19 @@ When a manufacturing order is created out of a procurement evaluation
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.
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
===========
@@ -71,7 +86,7 @@ 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:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`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.
@@ -110,6 +125,6 @@ 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/17.0/mrp_warehouse_calendar>`_ project on GitHub.
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.

View File

@@ -4,7 +4,7 @@
{
"name": "MRP Warehouse Calendar",
"summary": "Considers the warehouse calendars in manufacturing",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/manufacture",
"author": "ForgeFlow, Odoo Community Association (OCA)",

View File

@@ -1,7 +1,10 @@
- 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
![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 Resource Calendar.
Warehouses* and assign the Working Schedule.
![Warehouse Management](../static/description/warehouse_management.gif)

View File

@@ -1,8 +1,11 @@
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.
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.
Further manual replannings of start/end date of the manufacturing order
also consider the lead time using the warehouse calendar days.
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.

View File

@@ -3,6 +3,14 @@ When a manufacturing order is created out of a procurement evaluation
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
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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 KiB

View File

@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@ span.option {
span.pre {
white-space: pre }
span.problematic {
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -368,14 +369,15 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:18cdb9aea24afa77c86c9bf4c578ce490415389ba52053aabd18c04b457002eb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/17.0/mrp_warehouse_calendar"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-17-0/manufacture-17-0-mrp_warehouse_calendar"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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 products
manufacturing lead time, the planned start date of the manufacturing
order.</p>
<p>Further manual replannings of start/end date of the manufacturing order
also consider the lead time using the warehouse calendar days.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/18.0/mrp_warehouse_calendar"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-18-0/manufacture-18-0-mrp_warehouse_calendar"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module ensures that manufacturing orders created from procurements
respect the calendar assigned to the warehouse associated with the
manufacturing orders picking type. The planned start date of the
manufacturing order is calculated based on the products manufacturing
lead time and the working schedules defined in the warehouse calendar.</p>
<p>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.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -395,11 +397,11 @@ also consider the lead time using the warehouse calendar days.</p>
<ul class="simple">
<li>This module depends on
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse">stock_warehouse_calendar</a></li>
<li>Go to <em>Settings</em> and activate the developer mode.</li>
<li>Go to <em>Settings &gt; Technical &gt; Resource &gt; Working Time</em> and define
your resource calendar.</li>
<li>Go to <em>Settings</em> and activate the developer mode. <img alt="Developer mode" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/developer_mode.gif" /></li>
<li>Go to <em>Settings &gt; Technical &gt; Resource &gt; Working Schedules</em> and
define your resource calendar. <img alt="Working Schedules" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/working_schedules.gif" /></li>
<li>Go to <em>Inventory &gt; Configuration &gt; Warehouse Management &gt; Warehouses</em>
and assign the Resource Calendar.</li>
and assign the Working Schedule. <img alt="Warehouse Management" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/warehouse_management.gif" /></li>
</ul>
</div>
<div class="section" id="usage">
@@ -408,16 +410,20 @@ and assign the Resource Calendar.</li>
(from an orderpoint, MTO,…) the calendar is considered in the
computation of the planned start date of the manufacturing order.</p>
<p>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.</p>
required for Monday: <img alt="Replenish" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/replenish.png" /></p>
<p>the manufacturing order will be created with planned start date on the
previous Friday, if the warehouse operates under a Mo-Fri working
calendar. <img alt="Manufacturing Order" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/manufacturing_order.png" /></p>
<p>Manual changes to the start or end date of a manufacturing order will
also respect the lead time and the warehouse calendars working days.
<img alt="Manual change day" src="https://raw.githubusercontent.com/OCA/manufacture/18.0/mrp_warehouse_calendar/static/description/change_day.gif" /></p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_warehouse_calendar%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -438,13 +444,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/JordiBForgeFlow"><img alt="JordiBForgeFlow" src="https://github.com/JordiBForgeFlow.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/17.0/mrp_warehouse_calendar">OCA/manufacture</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/18.0/mrp_warehouse_calendar">OCA/manufacture</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

View File

@@ -27,11 +27,17 @@ class TestMrpWarehouseCalendar(TransactionCase):
{
"name": "test product",
"default_code": "PRD",
"type": "product",
"type": "consu",
"is_storable": "True",
}
)
self.product_2 = self.env["product.product"].create(
{"name": "test product 2", "default_code": "PRD 2", "type": "product"}
{
"name": "test product 2",
"default_code": "PRD 2",
"type": "consu",
"is_storable": "True",
}
)
self.bom = self.env["mrp.bom"].create(
{
@@ -50,8 +56,12 @@ class TestMrpWarehouseCalendar(TransactionCase):
self.product.route_ids = [(6, 0, self.manufacture_route.ids)]
def test_procurement_with_calendar(self):
"""Ensure that the planned start date of the manufacturing order
respects the warehouse calendar. The planned procurement date is
during a working interval, and the manufacturing lead time should
adjust the start date accordingly."""
values = {
"date_planned": "2097-01-07 09:00:00", # Monday
"date_planned": "2097-01-07 09:00:00", # Monday inside working hours
"warehouse_id": self.warehouse,
"company_id": self.company,
"rule_id": self.manufacture_route,
@@ -80,10 +90,12 @@ 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."""
"""Verify that procurement respects the warehouse calendar
when the planned date is outside working hours. The planned
manufacturing order start date should be adjusted to the last
available working interval."""
values = {
"date_planned": "2097-01-07 01:00:00", # Monday
"date_planned": "2097-01-07 01:00:00", # Monday outside working hours
"warehouse_id": self.warehouse,
"company_id": self.company,
"rule_id": self.manufacture_route,
@@ -112,6 +124,10 @@ class TestMrpWarehouseCalendar(TransactionCase):
self.assertEqual(date_plan_start, friday)
def test_onchange_date_planned(self):
"""Test the impact of changing the planned start date (`date_start`)
on the planned end date (`date_finished`) in a manufacturing order.
Verify that the system correctly computes the end date considering
the manufacturing lead time and the warehouse calendar."""
mo = self.env["mrp.production"].new(
{
"product_id": self.product.id,