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

[15.0][ADD] mrp_production_date_planned_finished_calendar (fixes Mondays CI runs) #1398

Merged
merged 3 commits into from
Nov 19, 2024
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
2 changes: 2 additions & 0 deletions mrp_multi_level/tests/test_mrp_multi_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from datetime import date, datetime, timedelta

from odoo import fields
from odoo.tests import tagged

from .common import TestMrpMultiLevelCommon


@tagged("post_install", "-at_install")
class TestMrpMultiLevel(TestMrpMultiLevelCommon):
def test_01_mrp_levels(self):
"""Tests computation of MRP levels."""
Expand Down
10 changes: 7 additions & 3 deletions mrp_production_date_planned_finished/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
class MrpProduction(models.Model):
_inherit = "mrp.production"

def _get_date_planned_start_using_delays(self):
date_planned_start = self.date_planned_finished
date_planned_start -= relativedelta(days=self.product_id.produce_delay)
date_planned_start -= relativedelta(days=self.company_id.manufacturing_lead)
return date_planned_start

@api.onchange("date_planned_finished")
def _onchange_date_planned_finished_set_date_planned_start(self):
if self.date_planned_finished and not self.is_planned:
date_planned_start = self.date_planned_finished
date_planned_start -= relativedelta(days=self.product_id.produce_delay)
date_planned_start -= relativedelta(days=self.company_id.manufacturing_lead)
date_planned_start = self._get_date_planned_start_using_delays()
if date_planned_start == self.date_planned_finished:
date_planned_start -= relativedelta(hours=1)
if self.date_planned_start != date_planned_start:
Expand Down
84 changes: 84 additions & 0 deletions mrp_production_date_planned_finished_calendar/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
=============================================
MRP Production Date Planned Finished Calendar
=============================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dfe27f551e8bd826eacd465bf8752bcc528b7f000525d006fa4c6d1a51280a79
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/15.0/mrp_production_date_planned_finished_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_production_date_planned_finished_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=15.0
:alt: Try me on Runboat

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

Glue module between `mrp_production_date_planned_finished` and `mrp_warehouse_calendar`.

**Table of contents**

.. contents::
:local:

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_production_date_planned_finished_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
~~~~~~~~~~~~

* 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-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
:target: https://github.com/LoisRForgeFlow
:alt: LoisRForgeFlow

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

|maintainer-LoisRForgeFlow|

This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/15.0/mrp_production_date_planned_finished_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_production_date_planned_finished_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_production_date_planned_finished_calendar/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "MRP Production Date Planned Finished Calendar",
"summary": "Allows to plan production from the desired finish date",
"version": "15.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow"],
"website": "https://github.com/OCA/manufacture",
"license": "AGPL-3",
"category": "Manufacturing",
"depends": ["mrp_production_date_planned_finished", "mrp_warehouse_calendar"],
"installable": True,
"auto_install": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mrp_production
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


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

def _get_date_planned_start_using_delays(self):
warehouse = self.picking_type_id.warehouse_id
date_planned_start = self.date_planned_finished
if warehouse.calendar_id:
delay = self.product_id.produce_delay + self.company_id.manufacturing_lead
return warehouse.calendar_id.plan_days(-1 * (delay + 1), date_planned_start)
return super()._get_date_planned_start_using_delays()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Lois Rilo <lois.rilo@forgeflow.com>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Glue module between `mrp_production_date_planned_finished` and `mrp_warehouse_calendar`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading