Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 5 years ago
parent
commit
bbbd92a815
  1. 2
      muk_utils/__manifest__.py
  2. 11
      muk_utils/models/mixins_hierarchy.py

2
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",

11
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()

Loading…
Cancel
Save