From e9c4b7cfc57f7d6200b222881772c37b26fd74fb Mon Sep 17 00:00:00 2001 From: Laetitia Da Costa Date: Wed, 20 Nov 2024 16:55:09 +0100 Subject: [PATCH 1/4] [IMP]partner_profiles:add quick filters for admin, public and fonction profiles --- partner_profiles/__manifest__.py | 2 +- partner_profiles/models/res_partner.py | 63 ++++++++++++++++++++- partner_profiles/views/res_partner_view.xml | 28 +++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) diff --git a/partner_profiles/__manifest__.py b/partner_profiles/__manifest__.py index e990147..27625e0 100644 --- a/partner_profiles/__manifest__.py +++ b/partner_profiles/__manifest__.py @@ -3,7 +3,7 @@ { "name": "partner_profiles", - "version": "16.0.1.0.1", + "version": "16.0.1.0.2", "author": "Elabore", "website": "https://elabore.coop", "maintainer": "Stéphan Sainléger", diff --git a/partner_profiles/models/res_partner.py b/partner_profiles/models/res_partner.py index 9fafb6e..7763e0b 100644 --- a/partner_profiles/models/res_partner.py +++ b/partner_profiles/models/res_partner.py @@ -287,11 +287,12 @@ class res_partner(models.Model): is_company=False, active=True, with_parent=False, + partner_profile=False ): search_values = [ ("is_company", "=", is_company), ("active", "=", active), - ("partner_profile", "=", False), + ("partner_profile", "=", partner_profile), ("type", "=", "contact") ] if id: @@ -437,4 +438,62 @@ class res_partner(models.Model): } ) count += 1 - _logger.debug("Last clean") \ No newline at end of file + _logger.debug("Last clean") + + @api.model + def _migration_main_profile_with_parent_and_not_existing_position_profile( + self, limit=None, id=False + ): + partner_profile_main = self.env.ref("partner_profiles.partner_profile_main").id + + partner_profile_position = self.env.ref("partner_profiles.partner_profile_position").id + + # Main Profil migration with parent_id + search_values = self._get_concerned_partners_search_values( + id, + with_parent=True, + partner_profile=partner_profile_main, + ) + partners = self.env["res.partner"].search(search_values, limit=limit) + _logger.debug("Main profile with parent_id - migration count: %s" % len(partners)) + count = 0 + + for partner in partners: + _logger.debug("count: [%s] : %s" % (count, partner.name)) + existing_position_partner = self.env["res.partner"].search( + self._get_position_partner_search_values(partner), + limit=1, + ) + if not existing_position_partner: + _logger.debug("CREATE Position %s" % partner.name) + self.env["res.partner"].create( + { + "name": partner.name, + "contact_id": partner.id, + "partner_profile": partner_profile_position, + "parent_id": partner.parent_id.id, + "is_position_profile": True, + } + ) + _logger.debug("UPDATE Main %s" % partner.name) + # partner.write( + # { + # "parent_id": False, + # } + #) + count += 1 + _logger.debug("### End migration ###") + + def _get_position_partner_search_values(self, partner): + return [ + ("active", "=", True), + ("type", "=", "contact"), + ("is_position_profile", "=", True), + ("is_company", "=", False), + ("contact_id", "=", partner.id), + "|", + ("name", "=", partner.name), + "&", + ("email", "!=", False), + ("email", "=", partner.email), + ] \ No newline at end of file diff --git a/partner_profiles/views/res_partner_view.xml b/partner_profiles/views/res_partner_view.xml index 056f175..8f41c79 100644 --- a/partner_profiles/views/res_partner_view.xml +++ b/partner_profiles/views/res_partner_view.xml @@ -1,6 +1,34 @@ + + res.partner.select.contact + res.partner + + + + + + + + + + Partner Profiles Form View res.partner -- 2.49.1 From ea47921d624a0b55cec9f6665da5e8dd772febcf Mon Sep 17 00:00:00 2001 From: Laetitia Da Costa Date: Thu, 21 Nov 2024 09:17:48 +0100 Subject: [PATCH 2/4] [IMP]partner_profiles:add action server sync pub/admin datas in mass --- partner_profiles/i18n/fr.po | 2 +- partner_profiles/views/res_partner_view.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/partner_profiles/i18n/fr.po b/partner_profiles/i18n/fr.po index 1b55041..09eef66 100644 --- a/partner_profiles/i18n/fr.po +++ b/partner_profiles/i18n/fr.po @@ -363,7 +363,7 @@ 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" +msgstr "Synch fiches pub/admin" #. module: partner_profiles #: model:ir.model.fields,field_description:partner_profiles.field_res_partner__to_migrate diff --git a/partner_profiles/views/res_partner_view.xml b/partner_profiles/views/res_partner_view.xml index 8f41c79..a3d4412 100644 --- a/partner_profiles/views/res_partner_view.xml +++ b/partner_profiles/views/res_partner_view.xml @@ -281,9 +281,10 @@ Synchronize main and public data + code records.sync_admin_and_public_data() - \ No newline at end of file + -- 2.49.1 From 3063ebd9fcce0b3501d020a767a63c7b45825538 Mon Sep 17 00:00:00 2001 From: Laetitia Da Costa Date: Thu, 21 Nov 2024 09:49:52 +0100 Subject: [PATCH 3/4] [IMP]partner_gogocarto_export_api: add mass edit in_gogocarto field --- partner_gogocarto_export_api/__manifest__.py | 2 +- partner_gogocarto_export_api/i18n/fr.po | 18 +++++++++++------- .../views/gogocarto_partner.xml | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/partner_gogocarto_export_api/__manifest__.py b/partner_gogocarto_export_api/__manifest__.py index 010cc78..9e1456e 100644 --- a/partner_gogocarto_export_api/__manifest__.py +++ b/partner_gogocarto_export_api/__manifest__.py @@ -8,7 +8,7 @@ ), 'website': 'https://lokavaluto.fr', 'category': 'Localization', - 'version': "16.0.1.0.0", + 'version': "16.0.1.0.1", 'depends': [ 'base', 'contacts', diff --git a/partner_gogocarto_export_api/i18n/fr.po b/partner_gogocarto_export_api/i18n/fr.po index 2f7efa3..16a4f8b 100644 --- a/partner_gogocarto_export_api/i18n/fr.po +++ b/partner_gogocarto_export_api/i18n/fr.po @@ -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 16.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" +"POT-Creation-Date: 2024-11-21 08:46+0000\n" +"PO-Revision-Date: 2024-11-21 08:46+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -28,7 +28,7 @@ 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" +msgstr "Paramètres de configuration" #. module: partner_gogocarto_export_api #: model:ir.model,name:partner_gogocarto_export_api.model_res_partner @@ -66,8 +66,12 @@ msgstr "" 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" + #. 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." - diff --git a/partner_gogocarto_export_api/views/gogocarto_partner.xml b/partner_gogocarto_export_api/views/gogocarto_partner.xml index d0481f0..3a79ade 100644 --- a/partner_gogocarto_export_api/views/gogocarto_partner.xml +++ b/partner_gogocarto_export_api/views/gogocarto_partner.xml @@ -11,4 +11,18 @@ - \ No newline at end of file + + + mass_edit + Mass Edit In Gogocarto Field + + + + + + + + + + + -- 2.49.1 From cebef576778319a5055f3167264cd1079c7cb589 Mon Sep 17 00:00:00 2001 From: Laetitia Da Costa Date: Mon, 25 Nov 2024 16:21:52 +0100 Subject: [PATCH 4/4] fixup! [IMP]partner_profiles:add quick filters for admin, public and fonction profiles --- partner_profiles/models/res_partner.py | 61 +------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/partner_profiles/models/res_partner.py b/partner_profiles/models/res_partner.py index 7763e0b..bd1a1e4 100644 --- a/partner_profiles/models/res_partner.py +++ b/partner_profiles/models/res_partner.py @@ -287,12 +287,11 @@ class res_partner(models.Model): is_company=False, active=True, with_parent=False, - partner_profile=False ): search_values = [ ("is_company", "=", is_company), ("active", "=", active), - ("partner_profile", "=", partner_profile), + ("partner_profile", "=", False), ("type", "=", "contact") ] if id: @@ -439,61 +438,3 @@ class res_partner(models.Model): ) count += 1 _logger.debug("Last clean") - - @api.model - def _migration_main_profile_with_parent_and_not_existing_position_profile( - self, limit=None, id=False - ): - partner_profile_main = self.env.ref("partner_profiles.partner_profile_main").id - - partner_profile_position = self.env.ref("partner_profiles.partner_profile_position").id - - # Main Profil migration with parent_id - search_values = self._get_concerned_partners_search_values( - id, - with_parent=True, - partner_profile=partner_profile_main, - ) - partners = self.env["res.partner"].search(search_values, limit=limit) - _logger.debug("Main profile with parent_id - migration count: %s" % len(partners)) - count = 0 - - for partner in partners: - _logger.debug("count: [%s] : %s" % (count, partner.name)) - existing_position_partner = self.env["res.partner"].search( - self._get_position_partner_search_values(partner), - limit=1, - ) - if not existing_position_partner: - _logger.debug("CREATE Position %s" % partner.name) - self.env["res.partner"].create( - { - "name": partner.name, - "contact_id": partner.id, - "partner_profile": partner_profile_position, - "parent_id": partner.parent_id.id, - "is_position_profile": True, - } - ) - _logger.debug("UPDATE Main %s" % partner.name) - # partner.write( - # { - # "parent_id": False, - # } - #) - count += 1 - _logger.debug("### End migration ###") - - def _get_position_partner_search_values(self, partner): - return [ - ("active", "=", True), - ("type", "=", "contact"), - ("is_position_profile", "=", True), - ("is_company", "=", False), - ("contact_id", "=", partner.id), - "|", - ("name", "=", partner.name), - "&", - ("email", "!=", False), - ("email", "=", partner.email), - ] \ No newline at end of file -- 2.49.1