Skip to content

Commit

Permalink
[ADD] - 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.
  • Loading branch information
sbejaoui committed Feb 15, 2023
1 parent e64ce06 commit 1df3d83
Show file tree
Hide file tree
Showing 22 changed files with 825 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,
)
88 changes: 88 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,88 @@
======================================================
Stock Release Channel Shipment Advice Process End Time
======================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/webui/builds.html?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. Go to inventory settings and set a global delay time for all channels.
2. Set a specific delay by warehouse.
3. 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.
If both aren't given, the global delay is applied.

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 smashing 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": """
c""",
"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",
"views/res_config_settings.xml",
],
"demo": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import res_company
from . import res_config_settings
from . import stock_warehouse
from . import stock_release_channel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):

_inherit = "res.company"

release_channel_process_end_time_delay = fields.Integer()
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):

_inherit = "res.config.settings"

release_channel_process_end_time_delay = fields.Integer(
related="company_id.release_channel_process_end_time_delay", readonly=False
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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

from odoo.addons.stock_release_channel_process_end_time.utils import float_to_time


class StockReleaseChannel(models.Model):

_inherit = "stock.release.channel"
process_end_time_delay = fields.Integer(
compute="_compute_process_end_time_delay", store=True, readonly=False
)

@api.depends("warehouse_id")
def _compute_process_end_time_delay(self):
for rec in self:
if not rec.process_end_time_delay:
rec.process_end_time_delay = (
rec.warehouse_id.release_channel_process_end_time_delay
)

def _get_process_end_time_delay(self, warehouse):
self.ensure_one()
if self.process_end_time_delay:
return self.process_end_time_delay
if not warehouse:
return 0
if warehouse.release_channel_process_end_time_delay:
return warehouse.release_channel_process_end_time_delay
return warehouse.company_id.release_channel_process_end_time_delay

def _get_shipment_advice_arrival_date(self, warehouse):
self.ensure_one()
process_end_time_delay = self._get_process_end_time_delay(warehouse)
hours = float_to_time(self.process_end_time)
return self.process_end_date.replace(
hour=hours.hour, minute=hours.minute
) + timedelta(minutes=process_end_time_delay)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class StockWarehouse(models.Model):

_inherit = "stock.warehouse"

release_channel_process_end_time_delay = fields.Integer(
compute="_compute_release_channel_end_time_delay", store=True, readonly=False
)

@api.depends("company_id")
def _compute_release_channel_end_time_delay(self):
for rec in self:
if not rec.release_channel_process_end_time_delay:
rec.release_channel_process_end_time_delay = (
rec.company_id.release_channel_process_end_time_delay
)
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,9 @@
To set the delay time you have three options:

1. Go to inventory settings and set a global delay time for all channels.
2. Set a specific delay by warehouse.
3. 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.
If both aren't given, the global delay is applied.
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 1df3d83

Please sign in to comment.