[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:
@@ -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",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user