[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.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
"version": "18.0.1.0.0",
|
"version": "18.0.1.0.0",
|
||||||
"depends": [
|
"depends": [
|
||||||
"base",
|
"base",
|
||||||
|
"base_setup",
|
||||||
"contacts",
|
"contacts",
|
||||||
"base_geolocalize",
|
"base_geolocalize",
|
||||||
"partner_geolocalize_usability",
|
"partner_geolocalize_usability",
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 16.0\n"
|
"Project-Id-Version: Odoo Server 18.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-11-21 08:46+0000\n"
|
"POT-Creation-Date: 2026-10-18 21:57+0000\n"
|
||||||
"PO-Revision-Date: 2024-11-21 08:46+0000\n"
|
"PO-Revision-Date: 2026-10-18 21:57+0000\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -46,6 +46,11 @@ msgstr "Champs exportés dans Gogocarto"
|
|||||||
msgid "Export to Gogocarto"
|
msgid "Export to Gogocarto"
|
||||||
msgstr "Exporter dans 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
|
#. module: partner_gogocarto_export_api
|
||||||
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields
|
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields
|
||||||
msgid "GogoCarto Exported fields"
|
msgid "GogoCarto Exported fields"
|
||||||
@@ -58,18 +63,18 @@ msgstr "Gogocarto"
|
|||||||
|
|
||||||
#. module: partner_gogocarto_export_api
|
#. module: partner_gogocarto_export_api
|
||||||
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
||||||
msgid "Gogocarto"
|
msgid "GogoCarto export configuration"
|
||||||
msgstr ""
|
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
|
#. module: partner_gogocarto_export_api
|
||||||
#: model:ir.actions.server,name:partner_gogocarto_export_api.mass_editing_partner
|
#: model:ir.actions.server,name:partner_gogocarto_export_api.mass_editing_partner
|
||||||
msgid "Mass Edit In Gogocarto Field"
|
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
|
#. module: partner_gogocarto_export_api
|
||||||
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# Translation of Odoo Server.
|
# Translation of Odoo Server.
|
||||||
# This file contains the translation of the following modules:
|
# This file contains the translation of the following modules:
|
||||||
# * partner_gogocarto_export_api
|
# * partner_gogocarto_export_api
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 18.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-09-12 14:00+0000\n"
|
"POT-Creation-Date: 2026-10-18 21:57+0000\n"
|
||||||
"PO-Revision-Date: 2023-09-12 14:00+0000\n"
|
"PO-Revision-Date: 2026-10-18 21:57+0000\n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -46,6 +46,11 @@ msgstr ""
|
|||||||
msgid "Export to Gogocarto"
|
msgid "Export to Gogocarto"
|
||||||
msgstr ""
|
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
|
#. module: partner_gogocarto_export_api
|
||||||
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields
|
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_config_settings__export_gogocarto_fields
|
||||||
msgid "GogoCarto Exported fields"
|
msgid "GogoCarto Exported fields"
|
||||||
@@ -58,16 +63,20 @@ msgstr ""
|
|||||||
|
|
||||||
#. module: partner_gogocarto_export_api
|
#. module: partner_gogocarto_export_api
|
||||||
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
#: 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 ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: partner_gogocarto_export_api
|
#. module: partner_gogocarto_export_api
|
||||||
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
#: 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 ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: partner_gogocarto_export_api
|
#. module: partner_gogocarto_export_api
|
||||||
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
|
#: 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."
|
msgid "Partner fields to export for Gogocarto map."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,35 @@
|
|||||||
import logging
|
import logging
|
||||||
from odoo import fields, models
|
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ResConfigSettings(models.TransientModel):
|
class ResConfigSettings(models.TransientModel):
|
||||||
_inherit = 'res.config.settings'
|
_inherit = "res.config.settings"
|
||||||
|
|
||||||
export_gogocarto_fields = fields.Many2many(
|
export_gogocarto_fields = fields.Many2many(
|
||||||
related='company_id.export_gogocarto_fields',
|
related="company_id.export_gogocarto_fields",
|
||||||
relation='ir.model.fields',
|
relation="ir.model.fields",
|
||||||
string='GogoCarto Exported fields',
|
string="GogoCarto Exported fields",
|
||||||
readonly=False,
|
readonly=False,
|
||||||
domain=[
|
domain=[
|
||||||
('model_id', '=', 'res.partner'),
|
("model_id", "=", "res.partner"),
|
||||||
('name', 'not in', ['name',
|
("name", "not in", ["name", "partner_longitude", "partner_latitude", "id"]),
|
||||||
'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",
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ from odoo.tests.common import TransactionCase
|
|||||||
|
|
||||||
|
|
||||||
class TestGogocartoSettingsView(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):
|
def test_settings_menu_entry_exists(self):
|
||||||
"""A dedicated ``<app>`` must exist so GogoCarto gets its own entry
|
"""A dedicated ``<app>`` must exist so GogoCarto gets its own entry
|
||||||
@@ -17,3 +19,17 @@ class TestGogocartoSettingsView(TransactionCase):
|
|||||||
)["arch"]
|
)["arch"]
|
||||||
self.assertIn('name="partner_gogocarto_export_api"', arch)
|
self.assertIn('name="partner_gogocarto_export_api"', arch)
|
||||||
self.assertIn("export_gogocarto_fields", 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",
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="res_config_settings_view_form_gogocarto" model="ir.ui.view">
|
<record id="res_config_settings_view_form_gogocarto" model="ir.ui.view">
|
||||||
<field name="name">res.config.settings.view.form.inherit.gogocarto</field>
|
<field name="name">res.config.settings.view.form.inherit.gogocarto</field>
|
||||||
@@ -7,19 +7,38 @@
|
|||||||
<field name="inherit_id" ref="base.res_config_settings_view_form" />
|
<field name="inherit_id" ref="base.res_config_settings_view_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//form" position="inside">
|
<xpath expr="//form" position="inside">
|
||||||
<app data-string="GogoCarto" string="GogoCarto"
|
<app
|
||||||
|
data-string="GogoCarto"
|
||||||
|
string="GogoCarto"
|
||||||
name="partner_gogocarto_export_api"
|
name="partner_gogocarto_export_api"
|
||||||
logo="/partner_gogocarto_export_api/static/description/icon.png">
|
logo="/partner_gogocarto_export_api/static/description/icon.png"
|
||||||
<block title="GogoCarto export configuration" name="gogocarto_settings" id="gogocarto_selection_settings">
|
>
|
||||||
<setting id="gogocarto_fields" help="Partner fields to export for Gogocarto map.">
|
<block
|
||||||
|
title="GogoCarto export configuration"
|
||||||
|
name="gogocarto_settings"
|
||||||
|
id="gogocarto_selection_settings"
|
||||||
|
>
|
||||||
|
<setting
|
||||||
|
id="gogocarto_fields"
|
||||||
|
help="Partner fields to export for Gogocarto map."
|
||||||
|
>
|
||||||
<div class="text-muted">
|
<div class="text-muted">
|
||||||
Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements.
|
Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements.
|
||||||
</div>
|
</div>
|
||||||
<div class="mt16">
|
<div class="mt16">
|
||||||
<field name="export_gogocarto_fields"
|
<field
|
||||||
|
name="export_gogocarto_fields"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True, 'no_open': True}" />
|
options="{'no_create': True, 'no_open': True}"
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="object"
|
||||||
|
name="action_open_gogocarto_export"
|
||||||
|
string="Open export URL"
|
||||||
|
icon="oi-arrow-right"
|
||||||
|
class="btn-link"
|
||||||
|
/>
|
||||||
</setting>
|
</setting>
|
||||||
</block>
|
</block>
|
||||||
</app>
|
</app>
|
||||||
|
|||||||
Reference in New Issue
Block a user