Skip to content

Commit

Permalink
[ADD] stock_release_channel_shipment_advice_process_end_time
Browse files Browse the repository at this point in the history
This module allows to set a delay time (in minutes) between the release channel
process end time and the shipment advice arrival to the dock time.

[IMP] - rename delay field to shipment_advice_arrival_delay

[IMP] - keep delay config at warehouse level
  • Loading branch information
sbejaoui authored and lmignon committed Feb 22, 2024
1 parent 97707e6 commit 4d0f62e
Show file tree
Hide file tree
Showing 20 changed files with 962 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
89 changes: 89 additions & 0 deletions stock_release_channel_shipment_advice_process_end_time/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
======================================================
Stock Release Channel Shipment Advice Process End Time
======================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:78895955a1921691e97975a1f79d5dfa0ecf28a12296331a1c8c42f6dc9612b2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fwms-lightgray.png?logo=github
:target: https://github.com/OCA/wms/tree/16.0/stock_release_channel_shipment_advice_process_end_time
:alt: OCA/wms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_release_channel_shipment_advice_process_end_time
: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/wms&target_branch=16.0
:alt: Try me on Runboat

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

This module allows to set a delay time (in minutes) between the release channel
process end time and the shipment advice arrival to the dock time.

**Table of contents**

.. contents::
:local:

Usage
=====

To set the delay time you have three options:

1. Set a specific delay by warehouse.
2. Set the delay at the release channel.

At shipment advices creation by the release channel, odoo will consider the channel
delay time first. If isn't set, it will take the warehouse delay configuration.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/wms/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/wms/issues/new?body=module:%20stock_release_channel_shipment_advice_process_end_time%0Aversion:%2016.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
~~~~~~~

* ACSONE SA/NV

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

* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
* Laurent Mignon <laurent.mignon@acsone.eu>

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.

This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/stock_release_channel_shipment_advice_process_end_time>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Stock Release Channel Shipment Advice Process End Time",
"summary": """This module allows to set a delay time (in minutes) between the
release channel process end time and the shipment advice arrival to the dock time.
""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/wms",
"depends": [
"stock_release_channel_shipment_advice",
"stock_release_channel_process_end_time",
],
"data": [
"views/stock_release_channel.xml",
"views/stock_warehouse.xml",
],
"demo": [],
}
102 changes: 102 additions & 0 deletions stock_release_channel_shipment_advice_process_end_time/i18n/fr_BE.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Traduction du serveur Odoo.
# Ce fichier contient la traduction des modules suivants :
# * stock_release_channel_shipment_advice_process_end_time
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-04 16:02+0000\n"
"PO-Revision-Date: 2023-08-04 16:02+0000\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: stock_release_channel_shipment_advice_process_end_time
#: model_terms:ir.ui.view,arch_db:stock_release_channel_shipment_advice_process_end_time.stock_release_channel_form_view
#: model_terms:ir.ui.view,arch_db:stock_release_channel_shipment_advice_process_end_time.stock_warehouse_form_view
msgid "<span>minutes</span>"
msgstr "<span>minutes</span>"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_arrival_time
msgid "Arrival to dock at"
msgstr "Arrivée au quai à"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,help:stock_release_channel_shipment_advice_process_end_time.field_stock_warehouse__release_channel_shipment_advice_arrival_delay
msgid "Default value for the delay between the release channel process end time and the arrival of shipments to docks of this warehouse."
msgstr "Valeur par défaut du délai entre l'heure de fin du processus du canal de livraison et l'arrivée des expéditions au quai de cet entrepôt."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,help:stock_release_channel_shipment_advice_process_end_time.field_stock_warehouse__release_channel_shipment_advice_departure_delay
msgid "Default value for the delay between the release channel process end time and the departure of shipments from the dock."
msgstr "Valeur par défaut du délai entre l'heure de fin du processus du canal de livraison et le départ des expéditions du quai."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_departure_time
msgid "Departure from dock at"
msgstr "Départ du quai à"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_warehouse__release_channel_shipment_advice_arrival_delay
msgid "Release Channel Shipment Advice Arrival Delay"
msgstr "Délai d'arrivée d'avis d'expédition du canal de livraison"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_warehouse__release_channel_shipment_advice_departure_delay
msgid "Release Channel Shipment Advice Departure Delay"
msgstr "Délai de départ d'avis d'expédition du canal de livraison"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_arrival_delay
msgid "Shipment Advice Arrival Delay"
msgstr "Délai d'arrivée de l'avis d'expédition"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,field_description:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_departure_delay
msgid "Shipment Advice Departure Delay"
msgstr "Délai de départ de l'avis d'expédition"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model,name:stock_release_channel_shipment_advice_process_end_time.model_shipment_advice_planner
msgid "Shipment Advice Planner"
msgstr "Planificateur d'avis d'expédition"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model_terms:ir.ui.view,arch_db:stock_release_channel_shipment_advice_process_end_time.stock_release_channel_form_view
msgid "Shipment loading and departure Settings"
msgstr "Paramètres de chargement et de départ des expéditions"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model,name:stock_release_channel_shipment_advice_process_end_time.model_stock_release_channel
msgid "Stock Release Channels"
msgstr "Canaux de livraison"

#. module: stock_release_channel_shipment_advice_process_end_time
#: model_terms:ir.ui.view,arch_db:stock_release_channel_shipment_advice_process_end_time.stock_release_channel_form_view
msgid "The delay between the process end time and the arrival of shipments to the dock."
msgstr "Le délai entre l'heure de fin du processus et l'arrivée des expéditions au quai."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model_terms:ir.ui.view,arch_db:stock_release_channel_shipment_advice_process_end_time.stock_release_channel_form_view
msgid "The delay between the process end time and the departure of shipments to the dock."
msgstr "Le délai entre l'heure de fin du processus et le départ des expéditions du quai."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,help:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_arrival_delay
msgid "The delay between the release channel process end time and the arrival of shipments to the dock."
msgstr "Le délai entre l'heure de fin du processus du canal de livraison et l'arrivée des expéditions au quai."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model.fields,help:stock_release_channel_shipment_advice_process_end_time.field_stock_release_channel__shipment_advice_departure_delay
msgid "The delay between the release channel process end time and the departure of shipments to the dock."
msgstr "Le délai entre l'heure de fin du processus du canal de livraison et le départ des expéditions du quai."

#. module: stock_release_channel_shipment_advice_process_end_time
#: model:ir.model,name:stock_release_channel_shipment_advice_process_end_time.model_stock_warehouse
msgid "Warehouse"
msgstr "Entrepôt"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_warehouse
from . import stock_release_channel
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from datetime import timedelta

from odoo import api, fields, models


class StockReleaseChannel(models.Model):

_inherit = "stock.release.channel"
shipment_advice_arrival_delay = fields.Integer(
compute="_compute_shipment_advice_arrival_delay",
store=True,
readonly=False,
help="The delay between the release channel process end time and the arrival "
"of shipments to the dock.",
)
shipment_advice_arrival_time = fields.Float(
"Arrival to dock at",
compute="_compute_shipment_advice_arrival_time",
inverse="_inverse_shipment_advice_arrival_time",
)
shipment_advice_departure_delay = fields.Integer(
compute="_compute_shipment_advice_departure_delay",
store=True,
readonly=False,
help="The delay between the release channel process end time and the departure "
"of shipments to the dock.",
)
shipment_advice_departure_time = fields.Float(
"Departure from dock at",
compute="_compute_shipment_advice_departure_time",
inverse="_inverse_shipment_advice_departure_time",
)

@api.depends("process_end_time", "shipment_advice_departure_delay")
def _compute_shipment_advice_departure_time(self):
for rec in self:
rec.shipment_advice_departure_time = rec.process_end_time + (
rec.shipment_advice_departure_delay / 60
)

def _inverse_shipment_advice_departure_time(self):
for rec in self:
rec.shipment_advice_departure_delay = (
rec.shipment_advice_departure_time - rec.process_end_time
) * 60

@api.depends("process_end_time", "shipment_advice_arrival_delay")
def _compute_shipment_advice_arrival_time(self):
for rec in self:
rec.shipment_advice_arrival_time = rec.process_end_time + (
rec.shipment_advice_arrival_delay / 60
)

def _inverse_shipment_advice_arrival_time(self):
for rec in self:
rec.shipment_advice_arrival_delay = (
rec.shipment_advice_arrival_time - rec.process_end_time
) * 60

@api.depends("warehouse_id")
def _compute_shipment_advice_arrival_delay(self):
for rec in self:
if not rec.shipment_advice_arrival_delay:
rec.shipment_advice_arrival_delay = (
rec.warehouse_id.release_channel_shipment_advice_arrival_delay
)

@api.depends("warehouse_id")
def _compute_shipment_advice_departure_delay(self):
for rec in self:
if not rec.shipment_advice_departure_delay:
rec.shipment_advice_departure_delay = (
rec.warehouse_id.release_channel_shipment_advice_departure_delay
)

def _get_shipment_advice_arrival_date(self):
self.ensure_one()
return self.process_end_date + timedelta(
minutes=self.shipment_advice_arrival_delay
)

def _get_shipment_advice_departure_date(self):
self.ensure_one()
return self.process_end_date + timedelta(
minutes=self.shipment_advice_departure_delay
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class StockWarehouse(models.Model):

_inherit = "stock.warehouse"

release_channel_shipment_advice_arrival_delay = fields.Integer(
help="Default value for the delay between the release channel process "
"end time and the arrival of shipments to docks of this warehouse.",
)
release_channel_shipment_advice_departure_delay = fields.Integer(
help="Default value for the delay between the release channel process "
"end time and the departure of shipments from the dock.",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
* Laurent Mignon <laurent.mignon@acsone.eu>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to set a delay time (in minutes) between the release channel
process end time and the shipment advice arrival to the dock time.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To set the delay time you have three options:

1. Set a specific delay by warehouse.
2. Set the delay at the release channel.

At shipment advices creation by the release channel, odoo will consider the channel
delay time first. If isn't set, it will take the warehouse delay configuration.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4d0f62e

Please sign in to comment.