Skip to content

Commit 93ab520

Browse files
[ADD] stock_release_channel_partner_delivery_window
1 parent d608609 commit 93ab520

File tree

17 files changed

+726
-0
lines changed

17 files changed

+726
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_release_channel_partner_delivery_window
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
=============================================
2+
Stock Release Channel Partner Delivery Window
3+
=============================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:19aeedd318a1b32f8829dc2bad0e0c7a27141d473a05db3aa90b3a6694b46390
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwms-lightgray.png?logo=github
20+
:target: https://github.com/OCA/wms/tree/16.0/stock_release_channel_partner_delivery_window
21+
:alt: OCA/wms
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-stock_release_channel_partner_delivery_window
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/wms&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module excludes the channel when its shipment date is not in Partner delivery window
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Bug Tracker
39+
===========
40+
41+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/wms/issues>`_.
42+
In case of trouble, please check there if your issue has already been reported.
43+
If you spotted it first, help us to smash it by providing a detailed and welcomed
44+
`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**>`_.
45+
46+
Do not contact contributors directly about support or help with technical issues.
47+
48+
Credits
49+
=======
50+
51+
Authors
52+
~~~~~~~
53+
54+
* Camptocamp
55+
* BCIM
56+
57+
Contributors
58+
~~~~~~~~~~~~
59+
60+
* Nguyen Minh Chien <chien@trobz.com>
61+
* Jacques-Etienne Baudoux <je@bcim.be>
62+
63+
Other credits
64+
~~~~~~~~~~~~~
65+
66+
The development of this module has been financially supported by Camptocamp
67+
68+
Maintainers
69+
~~~~~~~~~~~
70+
71+
This module is maintained by the OCA.
72+
73+
.. image:: https://odoo-community.org/logo.png
74+
:alt: Odoo Community Association
75+
:target: https://odoo-community.org
76+
77+
OCA, or the Odoo Community Association, is a nonprofit organization whose
78+
mission is to support the collaborative development of Odoo features and
79+
promote its widespread use.
80+
81+
.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px
82+
:target: https://github.com/jbaudoux
83+
:alt: jbaudoux
84+
85+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
86+
87+
|maintainer-jbaudoux|
88+
89+
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.
90+
91+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
{
4+
"name": "Stock Release Channel Partner Delivery Window",
5+
"summary": """
6+
Allows to define an end date (and time) on a release channel and
7+
propagate it to the concerned pickings""",
8+
"version": "16.0.1.0.0",
9+
"license": "AGPL-3",
10+
"maintainers": ["jbaudoux"],
11+
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/wms",
13+
"depends": [
14+
"stock_partner_delivery_window",
15+
"stock_release_channel_shipment_lead_time",
16+
],
17+
"data": [
18+
"views/stock_release_channel_view.xml",
19+
],
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import stock_picking
2+
from . import stock_release_channel
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from odoo import models
3+
4+
5+
class StockPicking(models.Model):
6+
7+
_inherit = "stock.picking"
8+
9+
def _find_release_channel_possible_candidate(self):
10+
"""Filter channels: make sure shipment date is in Partner window
11+
:return: release channels
12+
"""
13+
channels = super()._find_release_channel_possible_candidate()
14+
channels = channels.filter_release_channel_partner_window(self, self.partner_id)
15+
return channels
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from odoo import fields, models
3+
4+
5+
class StockReleaseChannel(models.Model):
6+
7+
_inherit = "stock.release.channel"
8+
9+
respect_partner_delivery_time_windows = fields.Boolean(
10+
string="Respect Partner Delivery time windows",
11+
default=False,
12+
help=(
13+
"If the delivery has moves linked to SO lines linked to SO that has"
14+
" a commitment_date, then we never respect the partner time window "
15+
"(it is not an exclusion selection criteria anymore)"
16+
),
17+
)
18+
19+
def filter_release_channel_partner_window(self, picking, partner):
20+
channels = self
21+
if (
22+
not partner.delivery_time_preference
23+
or partner.delivery_time_preference == "anytime"
24+
):
25+
return channels
26+
27+
for channel in self:
28+
if not channel.shipment_date:
29+
continue
30+
shipment_datetime = fields.Datetime.to_datetime(channel.shipment_date)
31+
if channel.process_end_date:
32+
shipment_datetime = shipment_datetime.replace(
33+
hour=channel.process_end_date.hour,
34+
minute=channel.process_end_date.minute,
35+
)
36+
if (
37+
channel.respect_partner_delivery_time_windows
38+
and not picking.sale_id.commitment_date
39+
and not partner.is_in_delivery_window(shipment_datetime)
40+
):
41+
channels -= channel
42+
return channels
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Nguyen Minh Chien <chien@trobz.com>
2+
* Jacques-Etienne Baudoux <je@bcim.be>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The development of this module has been financially supported by Camptocamp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module excludes the channel when its shipment date is not in Partner delivery window

stock_release_channel_partner_delivery_window/readme/USAGE.rst

Whitespace-only changes.
Loading

0 commit comments

Comments
 (0)