[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) <yti@odoo.com>
This commit is contained in:
Barad Mahendra
2021-02-16 13:35:26 +00:00
parent fed5854e32
commit f379e2e373
+5
View File
@@ -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')