-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] stock_release_channel_partner_delivery_window
- Loading branch information
1 parent
d608609
commit 93ab520
Showing
17 changed files
with
726 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...channel_partner_delivery_window/odoo/addons/stock_release_channel_partner_delivery_window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_release_channel_partner_delivery_window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
============================================= | ||
Stock Release Channel Partner Delivery Window | ||
============================================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:19aeedd318a1b32f8829dc2bad0e0c7a27141d473a05db3aa90b3a6694b46390 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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_partner_delivery_window | ||
: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_partner_delivery_window | ||
: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 excludes the channel when its shipment date is not in Partner delivery window | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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_partner_delivery_window%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 | ||
~~~~~~~ | ||
|
||
* Camptocamp | ||
* BCIM | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Nguyen Minh Chien <[email protected]> | ||
* Jacques-Etienne Baudoux <[email protected]> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The development of this module has been financially supported by Camptocamp | ||
|
||
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-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px | ||
:target: https://github.com/jbaudoux | ||
:alt: jbaudoux | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-jbaudoux| | ||
|
||
This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/stock_release_channel_partner_delivery_window>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
20 changes: 20 additions & 0 deletions
20
stock_release_channel_partner_delivery_window/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Release Channel Partner Delivery Window", | ||
"summary": """ | ||
Allows to define an end date (and time) on a release channel and | ||
propagate it to the concerned pickings""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"maintainers": ["jbaudoux"], | ||
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/wms", | ||
"depends": [ | ||
"stock_partner_delivery_window", | ||
"stock_release_channel_shipment_lead_time", | ||
], | ||
"data": [ | ||
"views/stock_release_channel_view.xml", | ||
], | ||
} |
2 changes: 2 additions & 0 deletions
2
stock_release_channel_partner_delivery_window/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import stock_picking | ||
from . import stock_release_channel |
15 changes: 15 additions & 0 deletions
15
stock_release_channel_partner_delivery_window/models/stock_picking.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import models | ||
|
||
|
||
class StockPicking(models.Model): | ||
|
||
_inherit = "stock.picking" | ||
|
||
def _find_release_channel_possible_candidate(self): | ||
"""Filter channels: make sure shipment date is in Partner window | ||
:return: release channels | ||
""" | ||
channels = super()._find_release_channel_possible_candidate() | ||
channels = channels.filter_release_channel_partner_window(self, self.partner_id) | ||
return channels |
42 changes: 42 additions & 0 deletions
42
stock_release_channel_partner_delivery_window/models/stock_release_channel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class StockReleaseChannel(models.Model): | ||
|
||
_inherit = "stock.release.channel" | ||
|
||
respect_partner_delivery_time_windows = fields.Boolean( | ||
string="Respect Partner Delivery time windows", | ||
default=False, | ||
help=( | ||
"If the delivery has moves linked to SO lines linked to SO that has" | ||
" a commitment_date, then we never respect the partner time window " | ||
"(it is not an exclusion selection criteria anymore)" | ||
), | ||
) | ||
|
||
def filter_release_channel_partner_window(self, picking, partner): | ||
channels = self | ||
if ( | ||
not partner.delivery_time_preference | ||
or partner.delivery_time_preference == "anytime" | ||
): | ||
return channels | ||
|
||
for channel in self: | ||
if not channel.shipment_date: | ||
continue | ||
shipment_datetime = fields.Datetime.to_datetime(channel.shipment_date) | ||
if channel.process_end_date: | ||
shipment_datetime = shipment_datetime.replace( | ||
hour=channel.process_end_date.hour, | ||
minute=channel.process_end_date.minute, | ||
) | ||
if ( | ||
channel.respect_partner_delivery_time_windows | ||
and not picking.sale_id.commitment_date | ||
and not partner.is_in_delivery_window(shipment_datetime) | ||
): | ||
channels -= channel | ||
return channels |
2 changes: 2 additions & 0 deletions
2
stock_release_channel_partner_delivery_window/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Nguyen Minh Chien <[email protected]> | ||
* Jacques-Etienne Baudoux <[email protected]> |
1 change: 1 addition & 0 deletions
1
stock_release_channel_partner_delivery_window/readme/CREDITS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The development of this module has been financially supported by Camptocamp |
1 change: 1 addition & 0 deletions
1
stock_release_channel_partner_delivery_window/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module excludes the channel when its shipment date is not in Partner delivery window |
Empty file.
Binary file added
BIN
+9.23 KB
stock_release_channel_partner_delivery_window/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.