-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] - add stock_release_channel_geoengine
[FIX] - fix geo-fields import
- Loading branch information
Showing
21 changed files
with
931 additions
and
1 deletion.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
setup/stock_release_channel_geoengine/odoo/addons/stock_release_channel_geoengine
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_geoengine |
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,92 @@ | ||
=============================== | ||
Stock Release Channel Geoengine | ||
=============================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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_geoengine | ||
: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_geoengine | ||
: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 enhance release channels with the addition of | ||
a delivery zone that can be selected by the delivery manager through the UI. | ||
If a zone is specified, the release channel will exclusively select deliveries | ||
for partners who are localized within that zone. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
In order to determine if a contact belongs to a geographical zone, | ||
this module relies on the `base_geoengine` addon. Thus, the `postgis` extension | ||
module for `postgresql` is needed for this purpose. | ||
|
||
Configuration | ||
============= | ||
|
||
- On the release channel, check `Restrict To Delivery Zone`. | ||
- Select the delivery zone. | ||
- To exclude certain partners from selection based on their location, you can | ||
uncheck the "Delivery based on geo-localization?" option in the partner view. | ||
|
||
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_geoengine%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 | ||
~~~~~~~~~~~~ | ||
|
||
* Laurent Mignon <[email protected]> | ||
* Souheil Bejaoui <[email protected]> | ||
|
||
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_geoengine>`_ 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 |
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,17 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Release Channel Geoengine", | ||
"summary": """Release channel based on geo-localization""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/wms", | ||
"depends": ["geoengine_partner", "stock_release_channel"], | ||
"data": [ | ||
"views/res_partner.xml", | ||
"views/stock_release_channel.xml", | ||
], | ||
"demo": [], | ||
} |
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,3 @@ | ||
from . import stock_release_channel | ||
from . import res_partner | ||
from . import stock_picking |
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,30 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
|
||
_inherit = "res.partner" | ||
|
||
in_geo_release_channel = fields.Boolean( | ||
string="Delivery based on geo-localization?", | ||
help="Include in release channels based on geographic zones", | ||
default=True, | ||
) | ||
stock_release_channel_ids = fields.Many2many( | ||
comodel_name="stock.release.channel", | ||
string="Release Channels", | ||
compute="_compute_stock_release_channel_id", | ||
) | ||
|
||
@api.depends("geo_point", "in_geo_release_channel") | ||
def _compute_stock_release_channel_id(self): | ||
for rec in self: | ||
if not rec.geo_point or not rec.in_geo_release_channel: | ||
rec.stock_release_channel_ids = False | ||
continue | ||
rec.stock_release_channel_ids = rec.stock_release_channel_ids.search( | ||
[("delivery_zone", "geo_intersect", rec.geo_point)] | ||
) |
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,22 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockPicking(models.Model): | ||
|
||
_inherit = "stock.picking" | ||
|
||
def _get_release_channel_possible_candidate_domain(self): | ||
self.ensure_one() | ||
domain = super()._get_release_channel_possible_candidate_domain() | ||
if self.partner_id.in_geo_release_channel: | ||
domain += [ | ||
"|", | ||
("restrict_to_delivery_zone", "=", False), | ||
("delivery_zone", "geo_intersect", self.partner_id.geo_point), | ||
] | ||
else: | ||
domain += [("restrict_to_delivery_zone", "=", False)] | ||
return domain |
18 changes: 18 additions & 0 deletions
18
stock_release_channel_geoengine/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,18 @@ | ||
# Copyright 2023 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
|
||
from odoo import fields, models | ||
|
||
from odoo.addons.base_geoengine.fields import GeoMultiPolygon | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class StockReleaseChannel(models.Model): | ||
|
||
_inherit = "stock.release.channel" | ||
|
||
restrict_to_delivery_zone = fields.Boolean() | ||
delivery_zone = GeoMultiPolygon() |
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,4 @@ | ||
- On the release channel, check `Restrict To Delivery Zone`. | ||
- Select the delivery zone. | ||
- To exclude certain partners from selection based on their location, you can | ||
uncheck the "Delivery based on geo-localization?" option in the partner view. |
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 @@ | ||
* Laurent Mignon <[email protected]> | ||
* Souheil Bejaoui <[email protected]> |
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,4 @@ | ||
This module enhance release channels with the addition of | ||
a delivery zone that can be selected by the delivery manager through the UI. | ||
If a zone is specified, the release channel will exclusively select deliveries | ||
for partners who are localized within that zone. |
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,3 @@ | ||
In order to determine if a contact belongs to a geographical zone, | ||
this module relies on the `base_geoengine` addon. Thus, the `postgis` extension | ||
module for `postgresql` is needed for this purpose. |
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.