From cebef576778319a5055f3167264cd1079c7cb589 Mon Sep 17 00:00:00 2001 From: Laetitia Da Costa Date: Mon, 25 Nov 2024 16:21:52 +0100 Subject: [PATCH] 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