From b43d79b1699d514f932372560781b147ef146f44 Mon Sep 17 00:00:00 2001
From: Paul Morelle <pmo@odoo.com>
Date: Wed, 24 May 2023 12:57:27 +0000
Subject: [PATCH] [FIX] website_customer: make res.partner.tag.classname
 overridable

The selection function get_selection_class for the field classname has
obviously been thought to be overridable by subclasses in order to add
new selection classes if need be.

However, before this commit the method was passed directly to the
Selection constructor, which used the callable object directly. If it
was overridden by a subclass, the Selection object would still use the
same non-overridden callable instance.

With this commit, we give the name of the method instead of the
callable, which makes that the method is resolved after all overrides,
and therefore the resulting selection will be the overridden one.

closes odoo/odoo#122377

X-original-commit: 91bea59678c92dbb06151dbf757398f588aeefdb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
---
 addons/website_customer/models/res_partner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/website_customer/models/res_partner.py b/addons/website_customer/models/res_partner.py
index 5ad57bc96c98..24592b3965b5 100644
--- a/addons/website_customer/models/res_partner.py
+++ b/addons/website_customer/models/res_partner.py
@@ -27,7 +27,7 @@ class Tags(models.Model):
 
     name = fields.Char('Category Name', required=True, translate=True)
     partner_ids = fields.Many2many('res.partner', 'res_partner_res_partner_tag_rel', 'tag_id', 'partner_id', string='Partners')
-    classname = fields.Selection(get_selection_class, 'Class', default='default', help="Bootstrap class to customize the color", required=True)
+    classname = fields.Selection('get_selection_class', 'Class', default='default', help="Bootstrap class to customize the color", required=True)
     active = fields.Boolean('Active', default=True)
 
     def _default_is_published(self):
-- 
GitLab