From f379e2e373e353040356bab9763eb26a55ae3a4f Mon Sep 17 00:00:00 2001 From: Barad Mahendra Date: Wed, 3 Feb 2021 08:51:44 +0000 Subject: [PATCH] [IMP] product: prevent the hierarchical category name in search panel Purpose of the commit is to prevent the hierarchical name of category in search panel. So in this commit, Override the the name_get to prevent the category hierarchy on search panel as we already displaying parent categroy in search panel. closes odoo/odoo#65442 Taskid: 2417252 Closes: #65442 Related: odoo/enterprise#15550 Signed-off-by: Yannick Tivisse (yti) --- addons/product/models/product.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 73f99112680..506d170a135 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -60,6 +60,11 @@ class ProductCategory(models.Model): def name_create(self, name): return self.create({'name': name}).name_get()[0] + def name_get(self): + if not self.env.context.get('hierarchical_naming', True): + return [(record.id, record.name) for record in self] + return super().name_get() + @api.ondelete(at_uninstall=False) def _unlink_except_default_category(self): main_category = self.env.ref('product.product_category_all')