Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
1e9fe1f88e
  1. 2
      muk_utils/__manifest__.py
  2. 16
      muk_utils/models/mixins_hierarchy.py

2
muk_utils/__manifest__.py

@ -19,7 +19,7 @@
{ {
"name": "MuK Utils", "name": "MuK Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": '12.0.1.4.10',
"version": '12.0.1.4.11',
"category": 'Extra Tools', "category": 'Extra Tools',
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",

16
muk_utils/models/mixins_hierarchy.py

@ -47,11 +47,15 @@ class Hierarchy(models.AbstractModel):
def add(name, field): def add(name, field):
if name not in self._fields: if name not in self._fields:
self._add_field(name, field) self._add_field(name, field)
path_names_search = None
if not self._parent_path_store:
path_names_search = '_search_parent_path_names',
add('parent_path_names', fields.Char( add('parent_path_names', fields.Char(
_module=self._module, _module=self._module,
compute='_compute_parent_path', compute='_compute_parent_path',
compute_sudo=self._parent_path_sudo, compute_sudo=self._parent_path_sudo,
store=self._parent_path_store, store=self._parent_path_store,
search=path_names_search,
string="Path Names", string="Path Names",
readonly=True, readonly=True,
automatic=True)) automatic=True))
@ -64,6 +68,18 @@ class Hierarchy(models.AbstractModel):
readonly=True, readonly=True,
automatic=True)) automatic=True))
#----------------------------------------------------------
# Search
#----------------------------------------------------------
@api.model
def _search_parent_path_names(self, operator, operand):
domain = []
for value in operand.split('/')
args = [(self._rec_name_fallback(), operator, value)]
domain = expression.OR(args, domain) if domain else args
return domain
#---------------------------------------------------------- #----------------------------------------------------------
# Read, View # Read, View
#---------------------------------------------------------- #----------------------------------------------------------

Loading…
Cancel
Save