From 9d3eeeb5c7d4055b34bc0768387952850ed78668 Mon Sep 17 00:00:00 2001 From: Richard Sassine Date: Mon, 31 May 2021 19:10:48 +0300 Subject: Added external pathing from NOC and traditional coordinates support. --- geoengine_partner/README.rst | 108 +++++ geoengine_partner/__init__.py | 1 + geoengine_partner/__manifest__.py | 14 + .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 188 bytes geoengine_partner/i18n/geoengine_partner.pot | 35 ++ geoengine_partner/models/__init__.py | 1 + .../models/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 196 bytes .../models/__pycache__/partner.cpython-36.pyc | Bin 0 -> 1542 bytes geoengine_partner/models/partner.py | 42 ++ geoengine_partner/readme/CONTRIBUTORS.rst | 7 + geoengine_partner/readme/CREDITS.rst | 1 + geoengine_partner/readme/DESCRIPTION.rst | 1 + geoengine_partner/readme/INSTALL.rst | 2 + geoengine_partner/readme/USAGE.rst | 14 + geoengine_partner/static/description/icon.png | Bin 0 -> 130328 bytes geoengine_partner/static/description/index.html | 452 +++++++++++++++++++++ geoengine_partner/views/partner.xml | 75 ++++ 17 files changed, 753 insertions(+) create mode 100644 geoengine_partner/README.rst create mode 100644 geoengine_partner/__init__.py create mode 100644 geoengine_partner/__manifest__.py create mode 100644 geoengine_partner/__pycache__/__init__.cpython-36.pyc create mode 100644 geoengine_partner/i18n/geoengine_partner.pot create mode 100644 geoengine_partner/models/__init__.py create mode 100644 geoengine_partner/models/__pycache__/__init__.cpython-36.pyc create mode 100644 geoengine_partner/models/__pycache__/partner.cpython-36.pyc create mode 100644 geoengine_partner/models/partner.py create mode 100644 geoengine_partner/readme/CONTRIBUTORS.rst create mode 100644 geoengine_partner/readme/CREDITS.rst create mode 100644 geoengine_partner/readme/DESCRIPTION.rst create mode 100644 geoengine_partner/readme/INSTALL.rst create mode 100644 geoengine_partner/readme/USAGE.rst create mode 100644 geoengine_partner/static/description/icon.png create mode 100644 geoengine_partner/static/description/index.html create mode 100644 geoengine_partner/views/partner.xml diff --git a/geoengine_partner/README.rst b/geoengine_partner/README.rst new file mode 100644 index 0000000..5171e9e --- /dev/null +++ b/geoengine_partner/README.rst @@ -0,0 +1,108 @@ +============================== +Geospatial support of partners +============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fgeospatial-lightgray.png?logo=github + :target: https://github.com/OCA/geospatial/tree/13.0/geoengine_partner + :alt: OCA/geospatial +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/geospatial-13-0/geospatial-13-0-geoengine_partner + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/115/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allow to geolocalise your partner. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +Take a look at the installation section in the description of the module +'base_geoengine'. + +Usage +===== + +To use this module, you need to: + +* Open a partner form +* Go in `Geoengine Map` tab +* Change to edit mode +* Click on the map to add a point or update It. + +To remove the point click on the trash bin. +To edit the point drag and drop it. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/115/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Guewen Baconnier +* Jordi Riera +* Laurent Mignon +* Nicolas Bessi +* Sandy Carter +* Yannick Vaucher +* Pierre Verkest + +Other credits +~~~~~~~~~~~~~ + +* Odoo Community Association: `Icon `_. + +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/geospatial `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/geoengine_partner/__init__.py b/geoengine_partner/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/geoengine_partner/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/geoengine_partner/__manifest__.py b/geoengine_partner/__manifest__.py new file mode 100644 index 0000000..eadc135 --- /dev/null +++ b/geoengine_partner/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2011-2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) +{ + "name": "Geospatial support of partners", + "version": "13.0.1.0.0", + "category": "GeoBI", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/geospatial", + "depends": ["base", "base_geoengine", "base_geolocalize"], + "data": ["views/partner.xml"], + "installable": True, + "application": True, +} diff --git a/geoengine_partner/__pycache__/__init__.cpython-36.pyc b/geoengine_partner/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..2c8c710 Binary files /dev/null and b/geoengine_partner/__pycache__/__init__.cpython-36.pyc differ diff --git a/geoengine_partner/i18n/geoengine_partner.pot b/geoengine_partner/i18n/geoengine_partner.pot new file mode 100644 index 0000000..875c82b --- /dev/null +++ b/geoengine_partner/i18n/geoengine_partner.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * geoengine_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \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: geoengine_partner +#: model:ir.model.fields,field_description:geoengine_partner.field_res_partner__geo_point +#: model:ir.model.fields,field_description:geoengine_partner.field_res_users__geo_point +msgid "Address coordinates" +msgstr "" + +#. module: geoengine_partner +#: model:ir.model,name:geoengine_partner.model_res_partner +msgid "Contact" +msgstr "" + +#. module: geoengine_partner +#: model:geoengine.raster.layer,name:geoengine_partner.geoengine_raster_layer_res_partner_osm +msgid "Partner background" +msgstr "" + +#. module: geoengine_partner +#: model:geoengine.vector.layer,name:geoengine_partner.geoengine_vector_layer_res_partner +msgid "Partner location" +msgstr "" diff --git a/geoengine_partner/models/__init__.py b/geoengine_partner/models/__init__.py new file mode 100644 index 0000000..4da81fa --- /dev/null +++ b/geoengine_partner/models/__init__.py @@ -0,0 +1 @@ +from . import partner diff --git a/geoengine_partner/models/__pycache__/__init__.cpython-36.pyc b/geoengine_partner/models/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..4fe2e53 Binary files /dev/null and b/geoengine_partner/models/__pycache__/__init__.cpython-36.pyc differ diff --git a/geoengine_partner/models/__pycache__/partner.cpython-36.pyc b/geoengine_partner/models/__pycache__/partner.cpython-36.pyc new file mode 100644 index 0000000..553a19f Binary files /dev/null and b/geoengine_partner/models/__pycache__/partner.cpython-36.pyc differ diff --git a/geoengine_partner/models/partner.py b/geoengine_partner/models/partner.py new file mode 100644 index 0000000..fee43c2 --- /dev/null +++ b/geoengine_partner/models/partner.py @@ -0,0 +1,42 @@ +# Copyright 2011-2020 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import fields, models, api +from pyproj import Transformer +from datetime import datetime + + +class ResPartner(models.Model): + """Add geo_point to partner using a function filed""" + + _inherit = "res.partner" + + geo_point = fields.GeoPoint("Geopoint") + + @api.onchange('geo_point') + def _onchange_geo_point(self): + odoo_proj = 'epsg:3857' + gps_proj = 'epsg:4326' + transformer = Transformer.from_crs(odoo_proj, gps_proj) + gps_point = transformer.transform( + self.geo_point.context[0], self.geo_point.context[1]) + self.partner_longitude = float(gps_point[0]) + self.partner_latitude = float(gps_point[1]) + self.date_localization = datetime.today() + + def navigate_from_noc(self): + noc_longitude = 34.1244 + noc_latitude = 35.6666 + longitude = self.partner_longitude + latitude = self.partner_latitude + zoom_level = 17 + + url = "https://www.openstreetmap.org/directions?engine=" + \ + f"fossgis_osrm_car&route={noc_longitude}%2C{noc_latitude}" + \ + f"%3B{longitude}%2C{latitude}" + return { + 'type': 'ir.actions.act_url', + 'name': 'Navigate From NOC', + "url" : url, + 'target': 'new', + } diff --git a/geoengine_partner/readme/CONTRIBUTORS.rst b/geoengine_partner/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..7c53528 --- /dev/null +++ b/geoengine_partner/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Guewen Baconnier +* Jordi Riera +* Laurent Mignon +* Nicolas Bessi +* Sandy Carter +* Yannick Vaucher +* Pierre Verkest diff --git a/geoengine_partner/readme/CREDITS.rst b/geoengine_partner/readme/CREDITS.rst new file mode 100644 index 0000000..cc056a8 --- /dev/null +++ b/geoengine_partner/readme/CREDITS.rst @@ -0,0 +1 @@ +* Odoo Community Association: `Icon `_. diff --git a/geoengine_partner/readme/DESCRIPTION.rst b/geoengine_partner/readme/DESCRIPTION.rst new file mode 100644 index 0000000..2da9286 --- /dev/null +++ b/geoengine_partner/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allow to geolocalise your partner. diff --git a/geoengine_partner/readme/INSTALL.rst b/geoengine_partner/readme/INSTALL.rst new file mode 100644 index 0000000..c9da3e4 --- /dev/null +++ b/geoengine_partner/readme/INSTALL.rst @@ -0,0 +1,2 @@ +Take a look at the installation section in the description of the module +'base_geoengine'. diff --git a/geoengine_partner/readme/USAGE.rst b/geoengine_partner/readme/USAGE.rst new file mode 100644 index 0000000..e2cc2ff --- /dev/null +++ b/geoengine_partner/readme/USAGE.rst @@ -0,0 +1,14 @@ +To use this module, you need to: + +* Open a partner form +* Go in `Geoengine Map` tab +* Change to edit mode +* Click on the map to add a point or update It. + +To remove the point click on the trash bin. +To edit the point drag and drop it. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/115/9.0 diff --git a/geoengine_partner/static/description/icon.png b/geoengine_partner/static/description/icon.png new file mode 100644 index 0000000..b698310 Binary files /dev/null and b/geoengine_partner/static/description/icon.png differ diff --git a/geoengine_partner/static/description/index.html b/geoengine_partner/static/description/index.html new file mode 100644 index 0000000..0913c80 --- /dev/null +++ b/geoengine_partner/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +Geospatial support of partners + + + +
+

Geospatial support of partners

+ + +

Beta License: AGPL-3 OCA/geospatial Translate me on Weblate Try me on Runbot

+

This module allow to geolocalise your partner.

+

Table of contents

+ +
+

Installation

+

Take a look at the installation section in the description of the module +‘base_geoengine’.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  • Open a partner form
  • +
  • Go in Geoengine Map tab
  • +
  • Change to edit mode
  • +
  • Click on the map to add a point or update It.
  • +
+

To remove the point click on the trash bin. +To edit the point drag and drop it.

+Try me on Runbot +
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Other credits

+
    +
  • Odoo Community Association: Icon.
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/geospatial project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/geoengine_partner/views/partner.xml b/geoengine_partner/views/partner.xml new file mode 100644 index 0000000..4f66d99 --- /dev/null +++ b/geoengine_partner/views/partner.xml @@ -0,0 +1,75 @@ + + + + geo_partner_form + res.partner + + + + + +