mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 03:52:00 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
# Geospatial support for base_geolocalize
|
||||
|
||||
Odoo addon: geoengine_base_geolocalize
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-geospatial-geoengine_base_geolocalize
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- base
|
||||
- geoengine_partner
|
||||
- base_geolocalize
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: Geospatial support for base_geolocalize
|
||||
- **Version**: 16.0.1.0.2
|
||||
- **Category**: GeoBI
|
||||
- **License**: AGPL-3
|
||||
- **Installable**: False
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/geospatial](https://github.com/OCA/geospatial) branch 16.0, addon `geoengine_base_geolocalize`.
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original AGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||
V --> C[Controllers]
|
||||
V --> W[Wizards – Transient Models]
|
||||
C --> M[Models and ORM]
|
||||
W --> M
|
||||
M --> R[Reports]
|
||||
DX[Data XML] --> M
|
||||
S[Security – ACLs and Groups] -. enforces .-> M
|
||||
|
||||
subgraph Geoengine_base_geolocalize Module - geoengine_base_geolocalize
|
||||
direction LR
|
||||
M:::layer
|
||||
W:::layer
|
||||
C:::layer
|
||||
V:::layer
|
||||
R:::layer
|
||||
S:::layer
|
||||
DX:::layer
|
||||
end
|
||||
|
||||
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||
```
|
||||
|
||||
Notes
|
||||
- Views include tree/form/kanban templates and report templates.
|
||||
- Controllers provide website/portal routes when present.
|
||||
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||
- Data XML loads data/demo records; Security defines groups and access.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Configuration
|
||||
|
||||
Refer to Odoo settings for geoengine_base_geolocalize. Configure related models, access rights, and options as needed.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- base
|
||||
- [geoengine_partner](../../odoo-bringout-oca-geospatial-geoengine_partner)
|
||||
- [base_geolocalize](../../odoo-bringout-oca-ocb-base_geolocalize)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||
- Q: How to enable? A: Start server with --addon geoengine_base_geolocalize or install in UI.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-geospatial-geoengine_base_geolocalize"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-geospatial-geoengine_base_geolocalize"
|
||||
```
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in geoengine_base_geolocalize.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class res_partner
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: geoengine_base_geolocalize. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon geoengine_base_geolocalize
|
||||
- License: LGPL-3
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Reports
|
||||
|
||||
This module does not define custom reports.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Security
|
||||
|
||||
This module does not define custom security rules or access controls beyond Odoo defaults.
|
||||
|
||||
Default Odoo security applies:
|
||||
- Base user access through standard groups
|
||||
- Model access inherited from dependencies
|
||||
- No custom row-level security rules
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Troubleshooting
|
||||
|
||||
- Ensure Python and Odoo environment matches repo guidance.
|
||||
- Check database connectivity and logs if startup fails.
|
||||
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Usage
|
||||
|
||||
Start Odoo including this addon (from repo root):
|
||||
|
||||
```bash
|
||||
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon geoengine_base_geolocalize
|
||||
```
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Wizards
|
||||
|
||||
This module does not include UI wizards.
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:alt: License
|
||||
|
||||
Geospatial support for base_geolocalize
|
||||
=======================================
|
||||
|
||||
Geolocalise your partner based on longitude and latitude provided by
|
||||
`OpenStreetMap via its Nominatim service
|
||||
<http://wiki.openstreetmap.org/wiki/Nominatim>`_. Please read carefully the
|
||||
`usage policy <http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy>`_
|
||||
before using the module.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Take a look at the installation section in the description of the module
|
||||
'base_geoengine'.
|
||||
|
||||
The module also requires one additional python libs:
|
||||
|
||||
* `requests <https://pypi.python.org/pypi/requests>`_
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/geospatial/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
|
||||
`here <https://github.com/OCA/geospatial/issues/new?body=module:%20geoengine_base_geolocalize%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: http://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: http://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Author: Laurent Mignon
|
||||
# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Geospatial support for base_geolocalize",
|
||||
"version": "16.0.1.0.2",
|
||||
"category": "GeoBI",
|
||||
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"website": "https://github.com/OCA/geospatial",
|
||||
"depends": ["base", "geoengine_partner", "base_geolocalize"],
|
||||
"external_dependencies": {"python": ["requests"]},
|
||||
"data": ["views/res_partner_view.xml"],
|
||||
"application": True,
|
||||
"autoinstall": True,
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * geoengine_base_geolocalize
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.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_base_geolocalize
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_partner__geo_point
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_users__geo_point
|
||||
msgid "Address coordinates"
|
||||
msgstr "Koordinate adrese"
|
||||
|
||||
#. module: geoengine_base_geolocalize
|
||||
#: model:ir.model,name:geoengine_base_geolocalize.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr "Kontakt"
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * geoengine_base_geolocalize
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.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_base_geolocalize
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_partner__geo_point
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_users__geo_point
|
||||
msgid "Address coordinates"
|
||||
msgstr ""
|
||||
|
||||
#. module: geoengine_base_geolocalize
|
||||
#: model:ir.model,name:geoengine_base_geolocalize.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * geoengine_base_geolocalize
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2024-01-26 08:36+0000\n"
|
||||
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.17\n"
|
||||
|
||||
#. module: geoengine_base_geolocalize
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_partner__geo_point
|
||||
#: model:ir.model.fields,field_description:geoengine_base_geolocalize.field_res_users__geo_point
|
||||
msgid "Address coordinates"
|
||||
msgstr "Coordinate indirizzo"
|
||||
|
||||
#. module: geoengine_base_geolocalize
|
||||
#: model:ir.model,name:geoengine_base_geolocalize.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr "Contatto"
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import res_partner
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# Copyright 2015 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
"""Add geo_point to partner using a function field"""
|
||||
|
||||
_inherit = "res.partner"
|
||||
|
||||
@api.depends("partner_latitude", "partner_longitude")
|
||||
def _compute_geo_point(self):
|
||||
"""
|
||||
Set the `geo_point` of the partner depending of its `partner_latitude`
|
||||
and its `partner_longitude`
|
||||
**Notes**
|
||||
If one of those parameters is not set then reset the partner's
|
||||
geo_point and do not recompute it
|
||||
"""
|
||||
for rec in self:
|
||||
if not rec.partner_latitude or not rec.partner_longitude:
|
||||
rec.geo_point = False
|
||||
else:
|
||||
rec.geo_point = fields.GeoPoint.from_latlon(
|
||||
rec.env.cr, rec.partner_latitude, rec.partner_longitude
|
||||
)
|
||||
|
||||
geo_point = fields.GeoPoint(
|
||||
store=True, compute="_compute_geo_point", inverse="_inverse_geo_point"
|
||||
)
|
||||
|
||||
def _inverse_geo_point(self):
|
||||
for rec in self:
|
||||
if not rec.geo_point:
|
||||
rec.partner_longitude, rec.partner_latitude = False, False
|
||||
else:
|
||||
(
|
||||
rec.partner_longitude,
|
||||
rec.partner_latitude,
|
||||
) = fields.GeoPoint.to_latlon(rec.env.cr, rec.geo_point)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
|
|
@ -0,0 +1 @@
|
|||
from . import test_geoengine_partner
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestGeoenginePartner(TransactionCase):
|
||||
def test_get_geo_point(self):
|
||||
partner_id = self.env.ref("base.user_root").partner_id
|
||||
partner_id.partner_longitude = False
|
||||
partner_id.partner_latitude = False
|
||||
self.assertFalse(
|
||||
partner_id.geo_point, "Should not have geo_point with no latlon"
|
||||
)
|
||||
partner_id.partner_latitude = 20
|
||||
self.assertFalse(
|
||||
partner_id.geo_point, "Should not have geo_point with no latlon"
|
||||
)
|
||||
partner_id.partner_longitude = 20
|
||||
self.assertTrue(partner_id.geo_point, "Should have geo_point")
|
||||
|
||||
def test_geo_localize(self):
|
||||
vals = {
|
||||
"name": "Partner Project",
|
||||
"street": "Rue au bois la dame",
|
||||
"country_id": self.env.ref("base.be").id,
|
||||
"zip": "6800",
|
||||
}
|
||||
partner_id = self.env["res.partner"].create(vals)
|
||||
partner_id.name = "Other Partner"
|
||||
partner_id.with_context(force_geo_localize=True).geo_localize()
|
||||
self.assertAlmostEqual(
|
||||
partner_id.partner_latitude, 49.9535323, 2, "Latitude Should be equals"
|
||||
)
|
||||
self.assertAlmostEqual(
|
||||
partner_id.partner_longitude, 5.4119073, 2, "Longitude Should be equals"
|
||||
)
|
||||
domain = [("id", "=", partner_id.id)]
|
||||
partner_id.unlink()
|
||||
self.assertFalse(
|
||||
self.env["res.partner"].search(domain),
|
||||
"Should not have this partner anymore",
|
||||
)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="geo_partner_view_form">
|
||||
<field name="name">geo_partner_form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="geoengine_partner.geo_partner_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='geoengine_map']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_crm_partner_geo_form">
|
||||
<field name="name">geo_partner_form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base_geolocalize.view_crm_partner_geo_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='geo_location']/group" position="after">
|
||||
<field
|
||||
name="geo_point"
|
||||
groups="base_geoengine.group_geoengine_user,base_geoengine.group_geoengine_admin"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-geospatial-geoengine_base_geolocalize"
|
||||
version = "16.0.0"
|
||||
description = "Geospatial support for base_geolocalize - Odoo addon"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-base>=16.0.0",
|
||||
"odoo-bringout-oca-geospatial-geoengine_partner>=16.0.0",
|
||||
"odoo-bringout-oca-geospatial-base_geolocalize>=16.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.11"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/bringout/0"
|
||||
repository = "https://github.com/bringout/0"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["geoengine_base_geolocalize"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue