[MIG] partner_profiles_gogocarto_export : Migration to 16.0

This commit is contained in:
Boris Gallet
2024-03-06 15:43:34 +01:00
committed by Stéphan Sainléger
parent 70694c19de
commit 142a0342c9
13 changed files with 305 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
*.*~
*pyc

View File

@@ -0,0 +1,56 @@
================================
partner_profiles_gogocarto_export
================================
Adapt data export for gogocarto to partner profiles logic
Installation
============
Use Odoo normal module installation procedure to install
``partner_profiles_gogocarto_export``.
Configuration
=============
To export public partners data:
#. Set the fields you want to export in Settings / Gogocarto, in the dedicated parameter for public profiles.
#. Check the field *"Export to Gogocarto"* in the partner form view of the main profile.
And use the link *https://yourodoo.com/web/<company_id>/get_http_gogocarto_elements* in Gogocarto server import configuration (*https://video.colibris-outilslibres.org/videos/watch/c74fc469-c822-4ab8-82a7-a2555e49e576*)
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/partner-tools/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.
Credits
=======
Contributors
------------
* Stéphan Sainléger
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
* Lokavaluto (https://lokavaluto.fr)
Maintainer
----------
This module is maintained by Elabore and Lokavaluto.

View File

@@ -0,0 +1,2 @@
from . import models

View File

@@ -0,0 +1,40 @@
# Copyright 2023 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "partner_profiles_gogocarto_export",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",
"license": "AGPL-3",
"category": "Tools",
"summary": "Adapt data export for gogocarto to partner profiles logic",
# any module necessary for this one to work correctly
"depends": [
"base",
"partner_gogocarto_export_api",
"partner_profiles",
"partner_profiles_geolocalize_usability",
],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/config_settings_view.xml",
"views/res_company_view.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1 @@
This directory should contain the *.po for Odoo translation.

View File

@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_profiles_gogocarto_export
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 14:02+0000\n"
"PO-Revision-Date: 2023-09-12 14:02+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: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de config"
#. module: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_partner
msgid "Contact"
msgstr "Contact"
#. module: partner_profiles_gogocarto_export
#: model:ir.model.fields,field_description:partner_profiles_gogocarto_export.field_res_company__export_gogocarto_public_fields
msgid "Export Gogocarto Public Fields"
msgstr "Export Gogocarto des champs publics"
#. module: partner_profiles_gogocarto_export
#: model:ir.model.fields,field_description:partner_profiles_gogocarto_export.field_res_config_settings__export_gogocarto_public_fields
msgid "GogoCarto Exported Public fields"
msgstr "Champs publics exportés dans Gogocarto"
#. module: partner_profiles_gogocarto_export
#: model_terms:ir.ui.view,arch_db:partner_profiles_gogocarto_export.res_config_settings_view_form_gogocarto_public
msgid "Partner public fields to export for Gogocarto map."
msgstr "Champs publics à exporter dans Gogocarto"

View File

@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_profiles_gogocarto_export
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 14:08+0000\n"
"PO-Revision-Date: 2023-09-12 14:08+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: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_company
msgid "Companies"
msgstr ""
#. module: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: partner_profiles_gogocarto_export
#: model:ir.model,name:partner_profiles_gogocarto_export.model_res_partner
msgid "Contact"
msgstr ""
#. module: partner_profiles_gogocarto_export
#: model:ir.model.fields,field_description:partner_profiles_gogocarto_export.field_res_company__export_gogocarto_public_fields
msgid "Export Gogocarto Public Fields"
msgstr ""
#. module: partner_profiles_gogocarto_export
#: model:ir.model.fields,field_description:partner_profiles_gogocarto_export.field_res_config_settings__export_gogocarto_public_fields
msgid "GogoCarto Exported Public fields"
msgstr ""
#. module: partner_profiles_gogocarto_export
#: model_terms:ir.ui.view,arch_db:partner_profiles_gogocarto_export.res_config_settings_view_form_gogocarto_public
msgid "Partner public fields to export for Gogocarto map."
msgstr ""

View File

@@ -0,0 +1,3 @@
from . import res_config_settings
from . import company
from . import res_partner

View File

@@ -0,0 +1,14 @@
from odoo import models, fields
class Company(models.Model):
_inherit = "res.company"
export_gogocarto_public_fields = fields.Many2many(
'ir.model.fields',
relation='ir_model_fields_gogocarto_public',
domain=[
('model_id', '=', 'res.partner'),
('name', 'not in', ['id', 'name', 'partner_longitude', 'partner_latitude'])
]
)

View File

@@ -0,0 +1,23 @@
import logging
from odoo import fields, models
_logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
export_gogocarto_public_fields = fields.Many2many(
related='company_id.export_gogocarto_public_fields',
relation='ir.model.fields',
string='GogoCarto Exported Public fields',
readonly=False,
domain=[
('model_id', '=', 'res.partner'),
('name', 'not in', ['name',
'partner_longitude',
'partner_latitude',
'id'])
]
)

View File

@@ -0,0 +1,29 @@
from odoo import models
import logging
class ResPartner(models.Model):
""" Inherits partner, adds Gogocarto public fields in the partner form, and functions"""
_inherit = 'res.partner'
def _get_gogocarto_domain(self, company_id):
# To OVERRIDE in sub_modules to customize the partner selection
res = super(ResPartner, self)._get_gogocarto_domain(company_id)
res.extend([('is_main_profile', '=', True)])
return res
def _get_gogocarto_parser(self, company_id):
parser = super(ResPartner, self)._get_gogocarto_parser(company_id)
public_fields = self._get_export_public_fields(company_id)
public_parser = self._get_generic_parser(public_fields)
parser.append(("public_profile_id", public_parser))
return parser
def _get_export_public_fields(self, company_id):
CompanySudo = self.env['res.company'].sudo().search([('id', '=', company_id)])
default_fields = self.env['ir.model.fields'].sudo().search([
('model_id', '=', 'res.partner'),
('name', 'in', ['id', 'name', 'partner_longitude', 'partner_latitude'])])
company_fields = CompanySudo.export_gogocarto_public_fields
export_fields = default_fields | company_fields
return export_fields

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form_gogocarto_public" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.gogocarto.public</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="partner_gogocarto_export_api.res_config_settings_view_form_gogocarto" />
<field name="arch" type="xml">
<xpath expr="//div[@id='gogocarto_selection_settings']" position="inside">
<div class="col-12 col-lg-6 o_setting_box" id="gogocarto_public_fields">
<div class="o_setting_right_pane">
<div class="text-muted">
Partner public fields to export for Gogocarto map.
</div>
<div class="content-group">
<div class="mt16">
<field name="export_gogocarto_public_fields" widget="many2many_tags"
options="{'no_create': True, 'no_open': True}" />
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="res_company_gogocarto_public_form_view">
<field name="name">res_company.gogocarto.public.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="partner_gogocarto_export_api.res_company_gogocarto_form_view" />
<field name='priority'>99</field>
<field name="arch" type="xml">
<xpath expr="//page[@name='gogocarto']" position="inside">
<group>
<field name="export_gogocarto_public_fields" />
</group>
</xpath>
</field>
</record>
</odoo>