20 Commits
16.0 ... 12.0

Author SHA1 Message Date
63fe3146ae [FIX]partner_gogocarto_export_api:syntax error 2024-05-21 14:05:38 +02:00
cd795bf295 [IMP]partner_gogocarto_export_api:allow export htlm fields 2024-03-26 11:13:49 +01:00
Stéphan Sainléger
cc897e65a9 [NEW] partner_favorite: transfer add-on
from repo
https://git.myceliandre.fr/OCA/partner-contact/commits/branch/nj-12.0-partner_gogocarto_export_api
2023-09-22 12:36:46 +02:00
Stéphan Sainléger
a5993e3786 [FIX] partner_profiles: correct unlink() for position profiles 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
eba51e1654 [IMP] partner_profiles_geolocalize_usability: add sync data function
inherits sync_admin_and_public_data function on res.partner to
synchronise partner latitude and longitude from main to public profiles.
2023-09-20 15:09:43 +02:00
Stéphan Sainléger
4e18b41b70 [IMP] partner_profiles: add sync function for admin and public data 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
edfb018ed3 [MIG] partner_profiles_gogocarto_export: migrate generic functions
Migrates generic geolocation functionalities to partner_profiles_geolocalize_usability
2023-09-20 15:09:43 +02:00
Stéphan Sainléger
127d8484b4 [MIG] partner_gogocarto_export_api: migrate generic fonctionalities
Migrates generic geolocation functionnalities to add-on partner_geolocalize_usability
2023-09-20 15:09:43 +02:00
Stéphan Sainléger
d2e558f13e [NEW] partner_profiles_geolocalize_usability: create add-on 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
ac95e1537c [NEW] partner_geolocalize_usability: create add-on 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
7a43a39e4f [NEW] partner_profiles_gogocarto_export: create add-on 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
597340ff98 [IMP] partner_profiles: add ids to public and position groups 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
102df5b9ef [FIX] partner_gogocarto_export_api: fix gogocarto config icon 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
87e02a7180 [IMP] partner_gogocarto_export_api: refactor gogocarto parser 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
65940d54ab [IMP] partner_gogocarto_export_api: refactor config settings view 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
a559fa9e42 [IMP] partner_gogocarto_export_api: add README.rst
and update __manifest__.py
2023-09-20 15:09:43 +02:00
Stéphan Sainléger
f5a597fa84 [I18N] partner_gogocarto_export_api: add french translations 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
2c2e2ef12b [IMP] partner_gogocarto_export_api: refactor partner form view 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
33ec7a728c [IMP] partner_gogocarto_export_api: add .gitignore 2023-09-20 15:09:43 +02:00
Stéphan Sainléger
de273ec571 [NEW] partner_gogocarto_export_api: create add-on
Transfers add-on partner_gogocarto_export_api from OCA partner-contact repo
2023-09-20 15:09:43 +02:00
66 changed files with 1362 additions and 11 deletions

View File

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

View File

@@ -0,0 +1,21 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Partner Favorite',
'summary': "Add favorite star on Partner, and filter for favorite",
'version': '12.0.1.1.0',
'author': "Nicolas JEUDY, "
"Myceliandre, "
"Lokavaluto, "
"Odoo Community Association (OCA)",
'license': "AGPL-3",
'maintainer': 'Nicolas JEUDY',
'category': 'Extra Tools',
'website': 'https://odoo-community.org/',
'depends': ['base'],
'data': [
'views/res_partner.xml',
],
'auto_install': False,
'installable': True,
}

View File

@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_favorite
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-10 20:53+0000\n"
"PO-Revision-Date: 2021-05-10 20:53+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_favorite
#: model:ir.model,name:partner_favorite.model_res_partner
msgid "Contact"
msgstr "Contact"
#. module: partner_favorite
#: model:ir.model.fields,help:partner_favorite.field_res_partner__is_favorite
#: model:ir.model.fields,help:partner_favorite.field_res_users__is_favorite
msgid "Display this partner with favorite filter"
msgstr "Afficher les partenaires favoris"
#. module: partner_favorite
#: model:ir.model.fields,field_description:partner_favorite.field_res_partner__favorite_user_ids
#: model:ir.model.fields,field_description:partner_favorite.field_res_users__favorite_user_ids
msgid "Members"
msgstr "Membres"
#. module: partner_favorite
#: model_terms:ir.ui.view,arch_db:partner_favorite.view_partner_search_favorite
msgid "My Favorites"
msgstr "Mes favoris"
#. module: partner_favorite
#: model:ir.model.fields,field_description:partner_favorite.field_res_partner__is_favorite
#: model:ir.model.fields,field_description:partner_favorite.field_res_users__is_favorite
msgid "Show Favorite Partner"
msgstr "Afficher les partenaire favoris"

View File

@@ -0,0 +1 @@
from . import res_partner

View File

@@ -0,0 +1,39 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import fields, models
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
"""Adds last name and first name; name becomes a stored function field."""
_inherit = 'res.partner'
def _compute_is_favorite(self):
for partner in self:
partner.is_favorite = self.env.user in partner.favorite_user_ids
def _inverse_is_favorite(self):
favorite_partners = not_fav_partners = self.env['res.partner']
for partner in self:
if self.env.user in partner.favorite_user_ids:
favorite_partners |= partner
else:
not_fav_partners |= partner
# partner User has no write access for partner.
not_fav_partners.write({'favorite_user_ids': [(4, self.env.uid)]})
favorite_partners.write({'favorite_user_ids': [(3, self.env.uid)]})
def _get_default_favorite_user_ids(self):
return [(6, 0, [self.env.uid])]
favorite_user_ids = fields.Many2many(
'res.users', 'partner_favorite_user_rel', 'partner_id', 'user_id',
default=_get_default_favorite_user_ids,
string='Members')
is_favorite = fields.Boolean(
compute='_compute_is_favorite',
inverse='_inverse_is_favorite',
string='Show Favorite Partner',
help="Display this partner with favorite filter")

View File

@@ -0,0 +1 @@
N/A

View File

@@ -0,0 +1 @@
* Nicolas JEUDY <https://github.com/njeudy>

View File

@@ -0,0 +1,2 @@
This module was written to extend the functionality of contacts to support
having favorite mechanism.

View File

@@ -0,0 +1 @@
* add filters

View File

@@ -0,0 +1 @@
After installing this module you can select a partner as favorite and filter on "My favorite".

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_partner_form_favorite" model="ir.ui.view">
<field name="name">Add favorite star</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<data>
<field name="type" position="after">
<field name="is_favorite"/>
</field>
<xpath expr="//strong/field[@name='display_name']" position="before">
<span class="o_right"><field name="is_favorite" widget="boolean_favorite" nolabel="1" force_save="1" /></span>
</xpath>
</data>
</field>
</record>
<record id="view_partner_search_favorite" model="ir.ui.view">
<field name="name">Add favorite star</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<data>
<filter name="filter_my_partners" position="after">
<filter string="My Favorites" name="my_partners" domain="[('favorite_user_ids', 'in', uid)]"/>
</filter>
</data>
</field>
</record>
</odoo>

View File

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

View File

@@ -0,0 +1,56 @@
=============================
partner_geolocalize_usability
=============================
Brings several enhancements on geolocalize functionnalities
Installation
============
Use Odoo normal module installation procedure to install
``partner_geolocalize_usability``.
Description
===========
This module allows:
- to block or not the edition of partner_latitude and partner_longitude fields in partner form view.
- to massively trigger the geolocalize function
It also modify the partner form vieww for a better understanding of the geolocation data.
Configuration
=============
No configuration needed.
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)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from . import models
# from . import controllers
# from . import wizard

View File

@@ -0,0 +1,35 @@
# Copyright 2023 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "partner_geolocalize_usability",
"version": "12.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",
"license": "AGPL-3",
"category": "Tools",
"summary": "Brings several enhancements on geolocalize functionnalities",
# any module necessary for this one to work correctly
"depends": [
"base",
"base_geolocalize"
],
"qweb": [],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/res_partner.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,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_geolocalize_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 13:48+0000\n"
"PO-Revision-Date: 2023-09-12 13:48+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_geolocalize_usability
#: model:ir.model,name:partner_geolocalize_usability.model_res_partner
msgid "Contact"
msgstr ""
#. module: partner_geolocalize_usability
#: model:ir.actions.server,name:partner_geolocalize_usability.geolocata_partner_action_server
#: model_terms:ir.ui.view,arch_db:partner_geolocalize_usability.partner_geolocalize_form_view
msgid "Geolocate"
msgstr "Géolocaliser"
#. module: partner_geolocalize_usability
#: model:ir.model.fields,field_description:partner_geolocalize_usability.field_res_partner__manual_geolocate
#: model:ir.model.fields,field_description:partner_geolocalize_usability.field_res_users__manual_geolocate
msgid "Geolocate yourself"
msgstr "Géolocaliser manuellement"
#. module: partner_geolocalize_usability
#: model_terms:ir.ui.view,arch_db:partner_geolocalize_usability.partner_geolocalize_form_view
msgid "Geolocation"
msgstr "Géolocalisation"

View File

@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_geolocalize_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 13:50+0000\n"
"PO-Revision-Date: 2023-09-12 13:50+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_geolocalize_usability
#: model:ir.model,name:partner_geolocalize_usability.model_res_partner
msgid "Contact"
msgstr ""
#. module: partner_geolocalize_usability
#: model:ir.actions.server,name:partner_geolocalize_usability.geolocata_partner_action_server
#: model_terms:ir.ui.view,arch_db:partner_geolocalize_usability.partner_geolocalize_form_view
msgid "Geolocate"
msgstr ""
#. module: partner_geolocalize_usability
#: model:ir.model.fields,field_description:partner_geolocalize_usability.field_res_partner__manual_geolocate
#: model:ir.model.fields,field_description:partner_geolocalize_usability.field_res_users__manual_geolocate
msgid "Geolocate yourself"
msgstr ""
#. module: partner_geolocalize_usability
#: model_terms:ir.ui.view,arch_db:partner_geolocalize_usability.partner_geolocalize_form_view
msgid "Geolocation"
msgstr ""

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import res_partner

View File

@@ -0,0 +1,12 @@
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
manual_geolocate = fields.Boolean('Geolocate yourself')
@api.multi
def geo_localize(self):
partners = self.filtered(lambda a: a.manual_geolocate == False)
return super(ResPartner, partners).geo_localize()

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="geolocata_partner_action_server" model="ir.actions.server">
<field name="name">Geolocate</field>
<field name="model_id" ref="model_res_partner" />
<field
name="binding_model_id" ref="model_res_partner" />
<field name="state">code</field>
<field name="code">records.geo_localize() </field>
</record>
<record model="ir.ui.view" id="partner_geolocalize_form_view">
<field name="name">partner.geolocalize.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name='priority'>99</field>
<field name="arch" type="xml">
<xpath expr="//page[@name='geo_location']" position="replace">
<page name="geolocalize" string="Geolocation">
<group colspan="2" col="2">
<separator string="Geolocation" colspan="2" />
<field name="manual_geolocate" />
<button
string="Geolocate"
name="geo_localize"
colspan="2"
icon="fa-check"
type="object" attrs="{'invisible':[('manual_geolocate', '=', True)]}" />
<field name="partner_latitude" attrs="{'readonly':[('manual_geolocate', '=', False)]}" />
<field name="partner_longitude" attrs="{'readonly':[('manual_geolocate', '=', False)]}" />
</group>
</page>
</xpath>
</field>
</record>
</odoo>

View File

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

View File

@@ -0,0 +1,66 @@
============================
partner_gogocarto_export_api
============================
Gogocarto Export module, to export the partner data needed for a Gogocarto map.
This module allow the users to decide:
* the partners to be exported
* the fields exported for each partner (*name*, *partner_longitude* and *partner_lattitude* automatically exported)
Installation
============
Use Odoo normal module installation procedure to install
``partner_gogocarto_export_api``, all dependencies will be installed by default.
Configuration
=============
To export partners data:
#. Set the fields you want to export in Settings / Gogocarto.
#. Check the field *"Export to Gogocarto"* in the partner form view.
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 SAINLEGER <https://github.com/stephansainleger>
* Chloé Migayrou <https://github.com/MigayrouChloe>
* Nicolas Jeudy <https://github.com/njeudy>
* Lokavaluto Teams <https://lokavaluto.fr>
Funders
-------
The development of this module has been financially supported by:
* Lokavaluto (https://lokavaluto.fr)
* Mycéliandre (https://myceliandre.fr)
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore and Lokavaluto.

View File

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

View File

@@ -0,0 +1,27 @@
{
'name': 'partner_gogocarto_export_api',
'summary': '''HTTP JSON api to send partner data for Gogocarto import''',
'license': 'AGPL-3',
'author': (
'Lokavaluto',
'Elabore'
),
'website': 'https://lokavaluto.fr',
'category': 'Localization',
'version': '12.0.2.0.0',
'depends': [
'base',
'contacts',
'base_geolocalize',
'partner_geolocalize_usability',
'base_jsonify',
],
'data': [
'views/gogocarto_partner.xml',
'views/gogocarto_config_settings_view.xml',
'views/res_company_view.xml',
],
'demo': [],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1 @@
from . import main

View File

@@ -0,0 +1,29 @@
import json
import logging
from odoo import http
from odoo.http import Response, request
_logger = logging.getLogger(__name__)
class PartnerGogocartojs(http.Controller):
@http.route(
'/web/<company_id>/get_http_gogocarto_elements',
methods=['GET'],
type='http',
csrf=False,
auth="public",
website=True)
def get_gogocarto_elements_http(self, company_id):
data = self._jsonify_get_partner(company_id)
return Response(json.dumps(data))
def _jsonify_get_partner(self, company_id):
PartnerSudo = request.env['res.partner'].sudo()
parser = PartnerSudo._get_gogocarto_parser(company_id)
partners = PartnerSudo.with_context(force_company=company_id).search(
PartnerSudo._get_gogocarto_domain(company_id)
)
return partners.jsonify(parser)

View File

@@ -0,0 +1,73 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_gogocarto_export_api
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 14:05+0000\n"
"PO-Revision-Date: 2023-09-12 14:05+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_gogocarto_export_api
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
msgid "Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements."
msgstr "Vérifiez l'export sur /web/{COMPANY_ID}/get_http_gogocarto_elements.\""
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_config_settings
msgid "Config Settings"
msgstr "Paramètres de config"
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_partner
msgid "Contact"
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_company__export_gogocarto_fields
msgid "Export Gogocarto Fields"
msgstr "Champs exportés dans Gogocarto"
#. module: partner_gogocarto_export_api
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_partner__in_gogocarto
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_users__in_gogocarto
msgid "Export to Gogocarto"
msgstr "Exporter dans Gogocarto"
#. 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"
msgstr "Champs exportés dans Gogocarto"
#. module: partner_gogocarto_export_api
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_company_gogocarto_form_view
msgid "GogoCarto Setup"
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"
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_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 "Champs de contact à exporter vers Gogocarto."

View File

@@ -0,0 +1,73 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_gogocarto_export_api
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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"
"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_gogocarto_export_api
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_gogocarto
msgid "Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements."
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_company
msgid "Companies"
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model,name:partner_gogocarto_export_api.model_res_partner
msgid "Contact"
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_company__export_gogocarto_fields
msgid "Export Gogocarto Fields"
msgstr ""
#. module: partner_gogocarto_export_api
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_partner__in_gogocarto
#: model:ir.model.fields,field_description:partner_gogocarto_export_api.field_res_users__in_gogocarto
msgid "Export to 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"
msgstr ""
#. module: partner_gogocarto_export_api
#: model_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_company_gogocarto_form_view
msgid "GogoCarto Setup"
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_terms:ir.ui.view,arch_db:partner_gogocarto_export_api.res_config_settings_view_form_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 "Partner fields to export for Gogocarto map."
msgstr ""

View File

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

View File

@@ -0,0 +1,13 @@
from odoo import models, fields
class Company(models.Model):
_inherit = "res.company"
export_gogocarto_fields = fields.Many2many(
'ir.model.fields',
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_fields = fields.Many2many(
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'])
]
)

View File

@@ -0,0 +1,49 @@
from odoo import models, fields
class ResPartner(models.Model):
""" Inherits partner, adds Gogocarto fields in the partner form, and functions"""
_inherit = 'res.partner'
in_gogocarto = fields.Boolean('Export to Gogocarto')
def _get_gogocarto_domain(self, company_id):
# To OVERRIDE in sub_modules to customize the partner selection
return [('in_gogocarto', '=', True)]
def _get_generic_parser(self, fields):
parser = []
for field in fields:
if field.ttype in [
"boolean",
"char",
"integer",
"monetary",
"text",
"selection",
"float",
"date_time",
"date",
"html"]:
parser.append(field.name)
elif field.ttype in ["many2one", "one2many", "many2many"]:
parser.append((field.name, ['id', 'name']))
elif field.ttype == "binary":
continue
else:
continue
return parser
def _get_gogocarto_parser(self, company_id):
fields = self._get_export_fields(company_id)
parser = self._get_generic_parser(fields)
return parser
def _get_export_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_fields
export_fields = default_fields | company_fields
return export_fields

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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="model">res.config.settings</field>
<field name="priority" eval="99" />
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block" data-string="Gogocarto" string="Gogocarto"
data-key="partner_gogocarto_export_api">
<h2>Gogocarto export configuration</h2>
<div class="text-muted mt16 o_settings_container">
Check the export on /web/{COMPANY_ID}/get_http_gogocarto_elements.
</div>
<div class="row mt16 o_settings_container" id="gogocarto_selection_settings">
<div class="col-12 col-lg-6 o_setting_box" id="gogocarto_fields">
<div class="o_setting_right_pane">
<div class="text-muted">
Partner fields to export for Gogocarto map.
</div>
<div class="content-group">
<div class="mt16">
<field name="export_gogocarto_fields"
widget="many2many_tags"
options="{'no_create': True, 'no_open': True}" />
</div>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="partner_gogocarto_form_view">
<field name="name">partner.gogocarto.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_geolocalize_usability.partner_geolocalize_form_view" />
<field name='priority'>99</field>
<field name="arch" type="xml">
<xpath expr="//page[@name='geolocalize']/group" position="inside">
<field name="in_gogocarto" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="res_company_gogocarto_form_view">
<field name="name">res_company.gogocarto.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name='priority'>99</field>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="GogoCarto Setup" name="gogocarto">
<group>
<field name="export_gogocarto_fields"/>
</group>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -3,7 +3,7 @@
{
"name": "partner_profiles",
"version": "12.0.2.4.0",
"version": "12.0.2.5.1",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-13 15:25+0000\n"
"PO-Revision-Date: 2023-06-13 15:25+0000\n"
"POT-Creation-Date: 2023-09-12 15:03+0000\n"
"PO-Revision-Date: 2023-09-12 15:03+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -73,7 +73,7 @@ msgstr "<span>Vous trouverez ici <strong>tou(te)s</strong> les adresses/contacts
msgid "<span>You are about to create a <strong>Position Profile</strong> which\n"
" represents the role or the job of a person in a structure.</span>"
msgstr "<span>Vous allez créer une <strong>fiche Fonction</strong> qui\n"
" représente le rôle que tient une personne au sein d'une structure.</span>""
" représente le rôle que tient une personne au sein d'une structure.</span>\""
#. module: partner_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles.partner_profiles_form_view
@@ -337,12 +337,12 @@ msgstr "État"
#. module: partner_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles.partner_profiles_form_view
msgid "Street 2..."
msgstr "Rue 2 ..."
msgstr "Rue 2..."
#. module: partner_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles.partner_profiles_form_view
msgid "Street..."
msgstr "Rue.."
msgstr "Rue..."
#. module: partner_profiles
#: model:ir.model.fields,field_description:partner_profiles.field_create_position_profile__structure_id
@@ -355,6 +355,16 @@ msgstr ""
msgid "Structure's positions"
msgstr "Fonctions occupées dans la structures"
#. module: partner_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles.partner_profiles_form_view
msgid "Sync data"
msgstr "Synchroniser"
#. module: partner_profiles
#: model:ir.actions.server,name:partner_profiles.sync_public_data_action_server
msgid "Synchronize main and public data"
msgstr "Synchroniser les données publiques"
#. module: partner_profiles
#: model:ir.model.fields,field_description:partner_profiles.field_res_partner__to_migrate
#: model:ir.model.fields,field_description:partner_profiles.field_res_users__to_migrate

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-13 15:24+0000\n"
"PO-Revision-Date: 2023-06-13 15:24+0000\n"
"POT-Creation-Date: 2023-09-12 15:02+0000\n"
"PO-Revision-Date: 2023-09-12 15:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -340,6 +340,16 @@ msgstr ""
msgid "Structure's positions"
msgstr ""
#. module: partner_profiles
#: model_terms:ir.ui.view,arch_db:partner_profiles.partner_profiles_form_view
msgid "Sync data"
msgstr ""
#. module: partner_profiles
#: model:ir.actions.server,name:partner_profiles.sync_public_data_action_server
msgid "Synchronize main and public data"
msgstr ""
#. module: partner_profiles
#: model:ir.model.fields,field_description:partner_profiles.field_res_partner__to_migrate
#: model:ir.model.fields,field_description:partner_profiles.field_res_users__to_migrate

View File

@@ -140,7 +140,7 @@ class res_partner(models.Model):
for partner in self:
if partner.is_company:
# Delete position profiles linked to the company main profile
for position in self.structure_position_ids:
for position in partner.structure_position_ids:
position.unlink()
return super(res_partner, self).unlink()
@@ -255,6 +255,22 @@ class res_partner(models.Model):
args.append(("is_public_profile", "=", False))
return super(res_partner, self).name_search(name, args, operator, limit)
@api.multi
def sync_admin_and_public_data(self):
for partner in self:
if partner.is_main_profile and partner.public_profile_id:
main_partner = partner
public_partner = partner.public_profile_id
elif partner.is_public_profile and partner.contact_id:
main_partner = partner.contact_id
public_partner = partner
public_fields = partner._get_public_profile_fields()
values = {}
for field_name in public_fields:
values[field_name] = main_partner._get_field_value(field_name)
public_partner.write(values)
##################################################################################
## Planned actions
##################################################################################

View File

@@ -42,6 +42,10 @@
<button type="object" name="create_public_profile"
string="Create Public Profile"
attrs="{'invisible': [('public_profile_id','!=',False)]}" />
<button string="Sync data"
name="sync_admin_and_public_data" type="object"
icon="fa-refresh"
attrs="{'invisible': [('public_profile_id','=',False)]}" />
</div>
</group>
</group>
@@ -173,7 +177,7 @@
<!-- PUBLIC PROFILE DISPLAY -->
<!-- ###################### -->
<xpath expr="//field[@name='type']/../.." position="after">
<group attrs="{'invisible': [('is_public_profile','=',False)]}">
<group id="public_data" attrs="{'invisible': [('is_public_profile','=',False)]}">
<group>
<label for="street" string="Address" />
<div class="o_address_format">
@@ -196,6 +200,7 @@
options='{"no_open": True, "no_create": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" />
</div>
</group>
<group>
<field name="phone" widget="phone" />
@@ -210,7 +215,8 @@
<!-- POSITION PROFILE DISPLAY -->
<!-- ######################## -->
<xpath expr="//field[@name='type']/../.." position="after">
<group attrs="{'invisible': [('is_position_profile','=',False)]}">
<group id="position_data"
attrs="{'invisible': [('is_position_profile','=',False)]}">
<group>
<field name="function" />
</group>
@@ -257,5 +263,13 @@
</xpath>
</field>
</record>
<record id="sync_public_data_action_server" model="ir.actions.server">
<field name="name">Synchronize main and public data</field>
<field name="model_id" ref="model_res_partner" />
<field name="groups_id" eval="[(4,ref('base.group_no_one'))]" />
<field name="state">code</field>
<field name="code">records.sync_admin_and_public_data() </field>
</record>
</data>
</odoo>

View File

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

View File

@@ -0,0 +1,53 @@
======================================
partner_profiles_geolocalize_usability
======================================
Adapt geolocalize usability to partner profiles logic
Installation
============
Use Odoo normal module installation procedure to install
``partner_profiles_geolocalize_usability``.
Description
===========
This module adds the geolocation data in the form view of public profiles.
Configuration
=============
No configuration needed.
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)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from . import models
# from . import controllers
# from . import wizard

View File

@@ -0,0 +1,38 @@
# Copyright 2023 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "partner_profiles_geolocalize_usability",
"version": "12.0.1.1.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",
"license": "AGPL-3",
"category": "Tools",
"summary": "Adapt geolocalize usability to partner profiles logic",
# any module necessary for this one to work correctly
"depends": [
"base",
"partner_geolocalize_usability",
"partner_profiles",
],
"qweb": [
# "static/src/xml/*.xml",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/res_partner.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,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_profiles_geolocalize_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 13:52+0000\n"
"PO-Revision-Date: 2023-09-12 13:52+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_geolocalize_usability
#: model_terms:ir.ui.view,arch_db:partner_profiles_geolocalize_usability.partner_geolocalize_form_view_public
msgid "Geolocate"
msgstr "Géolocaliser"

View File

@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_profiles_geolocalize_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-12 13:51+0000\n"
"PO-Revision-Date: 2023-09-12 13:51+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_geolocalize_usability
#: model_terms:ir.ui.view,arch_db:partner_profiles_geolocalize_usability.partner_geolocalize_form_view_public
msgid "Geolocate"
msgstr ""

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import res_partner

View File

@@ -0,0 +1,23 @@
from odoo import models, api
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.multi
def sync_admin_and_public_data(self):
super(ResPartner, self).sync_admin_and_public_data()
for partner in self:
if partner.is_main_profile and partner.public_profile_id:
main_partner = partner
public_partner = partner.public_profile_id
elif partner.is_public_profile and partner.contact_id:
main_partner = partner.contact_id
public_partner = partner
values = {
"manual_geolocate": main_partner.manual_geolocate,
"partner_latitude": main_partner.partner_latitude,
"partner_longitude": main_partner.partner_longitude,
}
public_partner.write(values)

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="partner_geolocalize_form_view_public">
<field name="name">partner.gogocarto.form.public</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_profiles.partner_profiles_form_view" />
<field name='priority'>99</field>
<field name="arch" type="xml">
<xpath expr="//group[@id='public_data']" position="inside">
<group>
<field name="manual_geolocate" />
<button
string="Geolocate"
name="geo_localize"
colspan="2"
icon="fa-check"
type="object" attrs="{'invisible':[('manual_geolocate', '=', True)]}" />
<field name="partner_latitude" attrs="{'readonly':[('manual_geolocate', '=', False)]}" />
<field name="partner_longitude" attrs="{'readonly':[('manual_geolocate', '=', False)]}" />
</group>
</xpath>
</field>
</record>
</odoo>

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,3 @@
# -*- coding: utf-8 -*-
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": "12.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>