Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions coopengo_modules/debug/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections import defaultdict
import pprint
import logging
import unicodedata

from trytond.wizard import Wizard, StateTransition, StateView, Button
from trytond.config import config
Expand Down Expand Up @@ -282,14 +283,15 @@ def recalculate_field_infos(self):
all_fields_infos = [
info for info in all_fields_infos if info is not None]
if self.name_filter:
name_filter = self.name_filter.replace('_', '').replace(
' ', '').lower()
name_filter = self.name_filter.lower()
all_fields_infos = [
info for info in all_fields_infos
if self.match_filter_name(name_filter, info)]
self.field_infos = sorted(
[x for x in all_fields_infos],
key=lambda x: getattr(x, self.filter_value))
key=lambda x: unicodedata.normalize('NFKD',
getattr(x, self.filter_value)).encode('ascii',
'ignore').decode('ascii'))
if self.id_to_calculate:
for field in self.field_infos:
try:
Expand All @@ -300,8 +302,8 @@ def recalculate_field_infos(self):

@staticmethod
def match_filter_name(name_filter, info):
return (name_filter in info.string.replace(' ', '').lower() or
name_filter in info.name.replace('_', ''))
return (name_filter in info.string.lower() or
name_filter in info.name)

@classmethod
def raw_field_info(cls, base_model, field_name):
Expand Down