From 9cabf044c82a857397f39ea83eb03e833f7f4550 Mon Sep 17 00:00:00 2001 From: luis Date: Thu, 14 Aug 2025 18:06:43 +0200 Subject: [PATCH] add website_partner_directory --- .gitignore | 56 ++++++++++++++++++ website_partner_directory/__init__.py | 2 + website_partner_directory/__manifest__.py | 18 ++++++ .../controllers/__init__.py | 1 + .../controllers/directory.py | 26 ++++++++ website_partner_directory/i18n/es.mo | Bin 0 -> 936 bytes website_partner_directory/i18n/es.po | 55 +++++++++++++++++ .../i18n/website_partner_directory.pot | 50 ++++++++++++++++ website_partner_directory/models/__init__.py | 1 + .../models/res_partner.py | 10 ++++ .../views/directory_template.xml | 44 ++++++++++++++ .../views/res_partner_views.xml | 12 ++++ 12 files changed, 275 insertions(+) create mode 100644 .gitignore create mode 100644 website_partner_directory/__init__.py create mode 100644 website_partner_directory/__manifest__.py create mode 100644 website_partner_directory/controllers/__init__.py create mode 100644 website_partner_directory/controllers/directory.py create mode 100644 website_partner_directory/i18n/es.mo create mode 100644 website_partner_directory/i18n/es.po create mode 100644 website_partner_directory/i18n/website_partner_directory.pot create mode 100644 website_partner_directory/models/__init__.py create mode 100644 website_partner_directory/models/res_partner.py create mode 100644 website_partner_directory/views/directory_template.xml create mode 100644 website_partner_directory/views/res_partner_views.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c200be --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# Archivos y carpetas generados por Odoo +*.log +*.pyc +*.pyo +__pycache__/ +*.db + +# Archivos de configuración de Odoo +*.sqlite +*.log +*.conf + +# Archivos de cache de Odoo +*.pid +*.sock +*.swp + +# Archivos de dependencias +*.egg +*.egg-info/ +dist/ +build/ + +# Entornos virtuales de Python +venv/ +env/ + +# Archivos de la base de datos +*.db +*.dump + +# Archivos de cobertura de prueba +.coverage + +# Archivos de editor (emacs, vim, etc.) +*~ +*.swp +.vscode/ +.idea/ +.DS_Store + +# Archivos de paquetes de dependencias +node_modules/ +*.bak + +# Archivos de logs +*.log +*.out + +# Archivos de configuraciones locales de Odoo +*.ini + +# Archivos temporales de Odoo (y otros archivos temporales) +*.tmp +*.bak +*.swp diff --git a/website_partner_directory/__init__.py b/website_partner_directory/__init__.py new file mode 100644 index 0000000..f7209b1 --- /dev/null +++ b/website_partner_directory/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import controllers diff --git a/website_partner_directory/__manifest__.py b/website_partner_directory/__manifest__.py new file mode 100644 index 0000000..e539065 --- /dev/null +++ b/website_partner_directory/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "Partner Directory with Map", + "version": "17.0.1.0.0", + "summary": "Directorio de empresas en website con mapa Leaflet", + "category": "Website", + "author": "Luis", + "depends": ["website_partner", "base_geolocalize"], + "data": ["views/res_partner_views.xml", "views/directory_template.xml"], + "assets": { + "web.assets_frontend": [ + "https://unpkg.com/leaflet/dist/leaflet.css", + "https://unpkg.com/leaflet/dist/leaflet.js", + # "website_partner_directory/static/src/js/map.js", + ] + }, + "installable": True, + "license": "LGPL-3", +} diff --git a/website_partner_directory/controllers/__init__.py b/website_partner_directory/controllers/__init__.py new file mode 100644 index 0000000..d2dabb1 --- /dev/null +++ b/website_partner_directory/controllers/__init__.py @@ -0,0 +1 @@ +from . import directory diff --git a/website_partner_directory/controllers/directory.py b/website_partner_directory/controllers/directory.py new file mode 100644 index 0000000..caeebf8 --- /dev/null +++ b/website_partner_directory/controllers/directory.py @@ -0,0 +1,26 @@ +from odoo import http +from odoo.http import request + + +class DirectoryController(http.Controller): + + @http.route(["/observatorio"], type="http", auth="public", website=True) + def directory(self, **kwargs): + partners = ( + request.env["res.partner"] + .sudo() + .search( + [ + ("is_company", "=", True), + ("show_in_directory", "=", True), + ("partner_latitude", "!=", False), + ("partner_longitude", "!=", False), + ] + ) + ) + return request.render( + "website_partner_directory.directory_page", + { + "partners": partners, + }, + ) diff --git a/website_partner_directory/i18n/es.mo b/website_partner_directory/i18n/es.mo new file mode 100644 index 0000000000000000000000000000000000000000..a3170a92eebdd2e552ba143278500d01a923cd56 GIT binary patch literal 936 zcmY*X%We}f6g5yD8rT3EBv@Q_AnGs)lvWdE1EeTYqeg8&NUWTh+te_z2iwz zK#ctfbbvp=0H8BMTm`=cr@(t4#(zF5#0~Hd@FnnXa2Na+{0f|&6XGWL0E`p?66b-q zq7K4N))ICXj;$wlQYkZ~4ef(CHa16|-JS~8O>t&|%7f_bP`=Cg8!nb9>}pT>+(G-g zEJ;-rD@WSE$5hp$Qs-1?$9XK$5WVO?lE;CzhNiZjC+=udkfIXuWFc|bj%H7e$2eoh zMXYLTM|ROwLu~Kb{pdK+5Cdmlqq^)B@&!8&m5eqEYiS#IVMoo?Mw)DKWnGYcKh}kO zT#vmR+KiIHrrhE^9h2l!6*!|-+FFt6nruEqVz#n+FKwl1vY~vCL#K={@dCa3I-*eCs7zq@Fr3H|t*Y*1rbK_u|IaK9>*Hf=nva-Kuy`EXsXE#jiq4m;U3 zxh=FAXS6obAsLjlQ>9$DZsIdC)uHJ-tv1cKojZnZcc^){oxGIK*sz=TJFr~nKo1&^ z5)r>#6_yI7?xb?;l^2Vj*Z(_?#=wegjhltpN17;?t3oYDlaHstViFX7ogE_B5SJ%E zgo4%VTO17A5M8*S9_Jy~vrn*aKNFmad9|4jgo>?|$`c>8cQh0ZvN$wkY7}wy)MRMX S?pqvU7!j}-8L02`Nc;msCKek2 literal 0 HcmV?d00001 diff --git a/website_partner_directory/i18n/es.po b/website_partner_directory/i18n/es.po new file mode 100644 index 0000000..678bfec --- /dev/null +++ b/website_partner_directory/i18n/es.po @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_partner_directory +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-14 15:56+0000\n" +"PO-Revision-Date: 2025-08-14 17:57+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.6\n" + +#. module: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "Company List" +msgstr "Listado de Empresas" + +#. module: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "Company Observatory" +msgstr "Observatorio de Empresas" + +#. module: website_partner_directory +#: model:ir.model,name:website_partner_directory.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: website_partner_directory +#: model:ir.model.fields,help:website_partner_directory.field_res_partner__show_in_directory +#: model:ir.model.fields,help:website_partner_directory.field_res_users__show_in_directory +msgid "If checked, this contact will appear in the public directory." +msgstr "" +"Si está marcada, este contacto aparecerá en el directorio público." + +#. module: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "" +"In this section you will find a list of companies registered in our " +"observatory." +msgstr "" +"En esta sección encontrará una lista de las empresas registradas en " +"nuestro observatorio." + +#. module: website_partner_directory +#: model:ir.model.fields,field_description:website_partner_directory.field_res_partner__show_in_directory +#: model:ir.model.fields,field_description:website_partner_directory.field_res_users__show_in_directory +msgid "Show in directory" +msgstr "Mostrar en observatorio web" diff --git a/website_partner_directory/i18n/website_partner_directory.pot b/website_partner_directory/i18n/website_partner_directory.pot new file mode 100644 index 0000000..097acd1 --- /dev/null +++ b/website_partner_directory/i18n/website_partner_directory.pot @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_partner_directory +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-14 15:55+0000\n" +"PO-Revision-Date: 2025-08-14 15:55+0000\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: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "Company List" +msgstr "" + +#. module: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "Company Observatory" +msgstr "" + +#. module: website_partner_directory +#: model:ir.model,name:website_partner_directory.model_res_partner +msgid "Contact" +msgstr "" + +#. module: website_partner_directory +#: model:ir.model.fields,help:website_partner_directory.field_res_partner__show_in_directory +#: model:ir.model.fields,help:website_partner_directory.field_res_users__show_in_directory +msgid "If checked, this contact will appear in the public directory." +msgstr "" + +#. module: website_partner_directory +#: model_terms:ir.ui.view,arch_db:website_partner_directory.directory_page +msgid "" +"In this section you will find a list of companies registered in our " +"observatory." +msgstr "" + +#. module: website_partner_directory +#: model:ir.model.fields,field_description:website_partner_directory.field_res_partner__show_in_directory +#: model:ir.model.fields,field_description:website_partner_directory.field_res_users__show_in_directory +msgid "Show in directory" +msgstr "" diff --git a/website_partner_directory/models/__init__.py b/website_partner_directory/models/__init__.py new file mode 100644 index 0000000..91fed54 --- /dev/null +++ b/website_partner_directory/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/website_partner_directory/models/res_partner.py b/website_partner_directory/models/res_partner.py new file mode 100644 index 0000000..3a04f37 --- /dev/null +++ b/website_partner_directory/models/res_partner.py @@ -0,0 +1,10 @@ +from odoo import models, fields + + +class ResPartner(models.Model): + _inherit = "res.partner" + + show_in_directory = fields.Boolean( + string="Show in directory", + help="If checked, this contact will appear in the public directory.", + ) diff --git a/website_partner_directory/views/directory_template.xml b/website_partner_directory/views/directory_template.xml new file mode 100644 index 0000000..6435049 --- /dev/null +++ b/website_partner_directory/views/directory_template.xml @@ -0,0 +1,44 @@ + + + diff --git a/website_partner_directory/views/res_partner_views.xml b/website_partner_directory/views/res_partner_views.xml new file mode 100644 index 0000000..68c5e6f --- /dev/null +++ b/website_partner_directory/views/res_partner_views.xml @@ -0,0 +1,12 @@ + + + res.partner.form.directory + res.partner + + + + + + + +