From 5fcc128e7379c157d91c2b0a4dcdcf3e1dda5f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Mon, 19 Oct 2026 00:01:15 +0200 Subject: [PATCH] [IMP] partner_gogocarto_export_api: add button to open the export URL Add an ``action_open_gogocarto_export`` method on ``res.config.settings`` returning an ``ir.actions.act_url`` (``target="new"``) pointing at the selected company's export endpoint, exposed as a link-style button next to the exported fields in the GogoCarto settings block. Re-add the ``base_setup`` dependency: the new method uses ``res.config.settings.company_id``, which is defined by ``base_setup`` (so is the ``company_id`` our ``export_gogocarto_fields`` related field already relies on). Its removal in 057e7a2 only worked because ``base_setup`` was pulled in transitively. Regenerate ``i18n/fr.po`` and the ``.pot`` from a live 18.0 instance, with the French translation for the new "Open export URL" string. The stale "Mass Edit In Gogocarto Field" translation (wrongly worded) is not carried over by the regenerated catalog. Verified on a local 18.0 instance: 11 tests, 0 failed, 0 error, and the settings arch renders "Ouvrir l'URL d'export" in French. --- partner_gogocarto_export_api/__manifest__.py | 1 + partner_gogocarto_export_api/i18n/fr.po | 25 ++++++++----- .../i18n/partner_gogocarto_export_api.pot | 25 +++++++++---- .../models/res_config_settings.py | 34 +++++++++++------ .../tests/test_settings_view.py | 18 ++++++++- .../views/gogocarto_config_settings_view.xml | 37 ++++++++++++++----- 6 files changed, 101 insertions(+), 39 deletions(-) diff --git a/partner_gogocarto_export_api/__manifest__.py b/partner_gogocarto_export_api/__manifest__.py index a5b9602..fb2411f 100644 --- a/partner_gogocarto_export_api/__manifest__.py +++ b/partner_gogocarto_export_api/__manifest__.py @@ -8,6 +8,7 @@ "version": "18.0.1.0.0", "depends": [ "base", + "base_setup", "contacts", "base_geolocalize", "partner_geolocalize_usability", diff --git a/partner_gogocarto_export_api/i18n/fr.po b/partner_gogocarto_export_api/i18n/fr.po index 16a4f8b..8eee783 100644 --- a/partner_gogocarto_export_api/i18n/fr.po +++ b/partner_gogocarto_export_api/i18n/fr.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-21 08:46+0000\n" -"PO-Revision-Date: 2024-11-21 08:46+0000\n" +"POT-Creation-Date: 2026-10-18 21:57+0000\n" +"PO-Revision-Date: 2026-10-18 21:57+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -46,6 +46,11 @@ msgstr "Champs exportés dans Gogocarto" msgid "Export to Gogocarto" msgstr "Exporter dans Gogocarto" +#. module: partner_gogocarto_export_api +#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto +msgid "GogoCarto" +msgstr "" + #. module: partner_gogocarto_export_api #: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields msgid "GogoCarto Exported fields" @@ -58,18 +63,18 @@ msgstr "Gogocarto" #. module: partner_gogocarto_export_api #: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto -msgid "Gogocarto" +msgid "GogoCarto export configuration" msgstr "" -#. module: partner_gogocarto_export_api -#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto -msgid "Gogocarto export configuration" -msgstr "Configuration de l'export Gogocarto" - #. module: partner_gogocarto_export_api #: model:ir.actions.server,name:partner_gogocarto_export_api.mass_editing_partner msgid "Mass Edit In Gogocarto Field" -msgstr "Exporter dans Gogocarto" +msgstr "" + +#. module: partner_gogocarto_export_api +#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto +msgid "Open export URL" +msgstr "Ouvrir l'URL d'export" #. module: partner_gogocarto_export_api #: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto diff --git a/partner_gogocarto_export_api/i18n/partner_gogocarto_export_api.pot b/partner_gogocarto_export_api/i18n/partner_gogocarto_export_api.pot index d1c0682..6a2e95e 100644 --- a/partner_gogocarto_export_api/i18n/partner_gogocarto_export_api.pot +++ b/partner_gogocarto_export_api/i18n/partner_gogocarto_export_api.pot @@ -1,14 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * partner_gogocarto_export_api +# * partner_gogocarto_export_api # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-12 14:00+0000\n" -"PO-Revision-Date: 2023-09-12 14:00+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2026-10-18 21:57+0000\n" +"PO-Revision-Date: 2026-10-18 21:57+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -46,6 +46,11 @@ msgstr "" msgid "Export to Gogocarto" msgstr "" +#. module: partner_gogocarto_export_api +#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto +msgid "GogoCarto" +msgstr "" + #. module: partner_gogocarto_export_api #: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields msgid "GogoCarto Exported fields" @@ -58,16 +63,20 @@ msgstr "" #. module: partner_gogocarto_export_api #: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto -msgid "Gogocarto" +msgid "GogoCarto export configuration" +msgstr "" + +#. module: partner_gogocarto_export_api +#: model:ir.actions.server,name:partner_gogocarto_export_api.mass_editing_partner +msgid "Mass Edit In Gogocarto Field" msgstr "" #. module: partner_gogocarto_export_api #: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto -msgid "Gogocarto export configuration" +msgid "Open export URL" msgstr "" #. module: partner_gogocarto_export_api #: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto msgid "Partner fields to export for Gogocarto map." msgstr "" - diff --git a/partner_gogocarto_export_api/models/res_config_settings.py b/partner_gogocarto_export_api/models/res_config_settings.py index 3a8a794..5df6ba4 100644 --- a/partner_gogocarto_export_api/models/res_config_settings.py +++ b/partner_gogocarto_export_api/models/res_config_settings.py @@ -1,23 +1,35 @@ import logging -from odoo import fields, models +from odoo import fields, models _logger = logging.getLogger(__name__) class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' + _inherit = "res.config.settings" export_gogocarto_fields = fields.Many2many( - related='company_id.export_gogocarto_fields', - relation='ir.model.fields', - string='GogoCarto Exported fields', + related="company_id.export_gogocarto_fields", + relation="ir.model.fields", + string="GogoCarto Exported fields", readonly=False, domain=[ - ('model_id', '=', 'res.partner'), - ('name', 'not in', ['name', - 'partner_longitude', - 'partner_latitude', - 'id']) - ] + ("model_id", "=", "res.partner"), + ("name", "not in", ["name", "partner_longitude", "partner_latitude", "id"]), + ], ) + + def action_open_gogocarto_export(self): + """ + Open the company's Gogocarto export endpoint in a new tab. + + :return: URL action targeting the export endpoint of the company selected in the + settings + :rtype: dict + """ + self.ensure_one() + return { + "type": "ir.actions.act_url", + "target": "new", + "url": f"/web/{self.company_id.id}/get_http_gogocarto_elements", + } diff --git a/partner_gogocarto_export_api/tests/test_settings_view.py b/partner_gogocarto_export_api/tests/test_settings_view.py index 8967794..0d87eb1 100644 --- a/partner_gogocarto_export_api/tests/test_settings_view.py +++ b/partner_gogocarto_export_api/tests/test_settings_view.py @@ -2,7 +2,9 @@ from odoo.tests.common import TransactionCase class TestGogocartoSettingsView(TransactionCase): - """Regression tests of the settings view structure.""" + """ + Regression tests of the settings view structure. + """ def test_settings_menu_entry_exists(self): """A dedicated ```` must exist so GogoCarto gets its own entry @@ -17,3 +19,17 @@ class TestGogocartoSettingsView(TransactionCase): )["arch"] self.assertIn('name="partner_gogocarto_export_api"', arch) self.assertIn("export_gogocarto_fields", arch) + + def test_action_opens_export_url_in_new_tab(self): + """ + The settings button returns a URL action to the current company's export + endpoint, opened in a new tab. + """ + settings = self.env["res.config.settings"].create({}) + action = settings.action_open_gogocarto_export() + self.assertEqual(action["type"], "ir.actions.act_url") + self.assertEqual(action["target"], "new") + self.assertEqual( + action["url"], + f"/web/{settings.company_id.id}/get_http_gogocarto_elements", + ) diff --git a/partner_gogocarto_export_api/views/gogocarto_config_settings_view.xml b/partner_gogocarto_export_api/views/gogocarto_config_settings_view.xml index 052dbbf..51af420 100644 --- a/partner_gogocarto_export_api/views/gogocarto_config_settings_view.xml +++ b/partner_gogocarto_export_api/views/gogocarto_config_settings_view.xml @@ -1,4 +1,4 @@ - + res.config.settings.view.form.inherit.gogocarto @@ -7,19 +7,38 @@ - - - + logo="/partner_gogocarto_export_api/static/description/icon.png" + > + +
Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements.
-
- + -
+ options="{'no_create': True, 'no_open': True}" + /> + +