diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index f608b43..6ad3f19 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.1.1.17', + "version": '12.0.1.1.18', "category": 'Extra Tools', "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_utils/models/mixins_hierarchy.py b/muk_utils/models/mixins_hierarchy.py index dc6d475..f3fb693 100644 --- a/muk_utils/models/mixins_hierarchy.py +++ b/muk_utils/models/mixins_hierarchy.py @@ -71,19 +71,18 @@ class Hierarchy(models.AbstractModel): def _compute_parent_path(self): paths = [list(map(int, rec.parent_path.split('/')[:-1])) for rec in self] ids = set(functools.reduce(operator.concat, paths)) - recs = self.with_context(prefetch_fields=False).browse(ids) - data = {rec.id: (rec._name, rec.name) for rec in recs} + data = dict(self.browse(ids).name_get()) for record in self: path_names = [] path_json = [] for id in reversed(list(map(int, record.parent_path.split('/')[:-1]))): if id not in data: break - path_names.append(data[id][1]) + path_names.append(data[id][0]) path_json.append({ - 'model': data[id][0], - 'name': data[id][1], - 'id': id, + 'model': record._name, + 'name': data[id][0], + 'id': record.id, }) path_names.reverse() path_json.reverse()